Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem with print_r

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
gordonisnz
Smarty Regular


Joined: 05 Sep 2009
Posts: 70

PostPosted: Sat May 08, 2021 6:40 am    Post subject: Problem with print_r Reply with quote

Hello, I have a small problem with print_r

$array.$key|@print_r

when i look at this - the output is flushed to the left instead of being indented.. i cannot easily see any sub-arrays within it - Everything is flushed to the left. (even if I look at the HTML source)

im on Version 3.1.34-dev-7

any advice ?
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Tue May 11, 2021 6:20 pm    Post subject: Reply with quote

I made this experiment with Smarty 3.1.36:
Code:
{$Class|@print_r}
where $Class is a multi-level array.

The HTML source looks like what print_r should look like.

The compiled template has this statement:
Code:
echo print_r($_smarty_tpl->tpl_vars['Class']->value);?>
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat May 15, 2021 11:38 am    Post subject: Reply with quote

1. $var|print_r:true
2. Indentation is a function of the user agent.
If you render to HTML, use HTML tags for presentation.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP