Solved

Smarty break <br> tag in date.

Posted on 2011-09-08
9
504 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 109

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 109

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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