Solved

Smarty break <br> tag in date.

Posted on 2011-09-08
9
485 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
 
LVL 108

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 108

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Router for PHP reqeusts 12 33
Encode a password 2 38
WooCommerce Sort by Date 4 10
Creating Image Thumbnails Using PHP 3 16
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now