• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

Smarty break <br> tag in date.

I am currently using {$i.XXX|XXX:"M j D"} which displays as Sep 10 Sat  (personal datat is replaced with XXX)

but I need it like this
Sep  
10
Sat

Is there another way to display this or is there an actual tag like the <br> tag?
0
Caiapfas
Asked:
Caiapfas
  • 3
  • 3
  • 2
  • +1
3 Solutions
 
athomsfereCommented:
Looks like you can use heredoc: http://www.tizag.com/phpT/strings.php
0
 
boon86Commented:
try this:

{$i.XXX|XXX:"M<br />j<br />D<br />"}

Open in new window


let me know if it work
0
 
boon86Commented:
php:
<?php
$now = strtotime("now");
$smarty->assign('now', $now );
?>

Open in new window


smarty:
{ $now|date_format:'%Y%n%m%n%d'}

Open in new window


i used: %n
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Ray PaseurCommented:
This works in native PHP.  See the output here:
http://www.laprbass.com/RAY_temp_caiapfas.php
<?php // RAY_temp_caiapfas.php
error_reporting(E_ALL);
echo "<pre>";

// REQUIRED FOR PHP 5.1+
date_default_timezone_set('America/Chicago');

// A DATE FORMATTING STRING WITH CERTAIN CHARACTERS ESCAPED
$str = date('M<\b\r/>j<\b\r/>D');
echo $str;
echo PHP_EOL;

// SHOW THE DETAILS
echo htmlentities($str);

Open in new window

0
 
CaiapfasAuthor Commented:
thanks but none of these suggestions worked.
0
 
boon86Commented:
can you paste me your php and smarty tpl code here?
0
 
Ray PaseurCommented:
What did these suggestions do?  "None worked" is not exactly a symptom we can work on.  If you run the script I posted above (or just click the link to the test script on my server) you will see that it creates exactly the output you asked for.  Then you will at least know the way the PHP needs to work.  From there you may be able to figure out how to get the Smarty templates out of the way, or at least get them to cooperate.
0
 
CaiapfasAuthor Commented:
I was able to do this by putting each tag in a div
0
 
CaiapfasAuthor Commented:
solved the problem on my own by placing each smarty tag in a separate div
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now