Solved

Smarty break <br> tag in date.

Posted on 2011-09-08
9
529 Views
Last Modified: 2012-05-12
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
Comment
Question by:Caiapfas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 14

Expert Comment

by:athomsfere
ID: 36506809
Looks like you can use heredoc: http://www.tizag.com/phpT/strings.php
0
 
LVL 7

Accepted Solution

by:
boon86 earned 334 total points
ID: 36509304
try this:

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

Open in new window


let me know if it work
0
 
LVL 7

Assisted Solution

by:boon86
boon86 earned 334 total points
ID: 36509331
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 36516517
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
 
LVL 2

Author Comment

by:Caiapfas
ID: 36526433
thanks but none of these suggestions worked.
0
 
LVL 7

Expert Comment

by:boon86
ID: 36526564
can you paste me your php and smarty tpl code here?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 36526818
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
 
LVL 2

Author Comment

by:Caiapfas
ID: 36552171
I was able to do this by putting each tag in a div
0
 
LVL 2

Author Closing Comment

by:Caiapfas
ID: 36552180
solved the problem on my own by placing each smarty tag in a separate div
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question