'print_r' in a tpl template??
rsoul
![]()
Joined: 2006-01-27
Posts: 6 |
![]() |
Hi all, How can call the equivalent of php's print_r() function on a Smarty variable?? i.e. from the album.tpl there is a line: {foreach from=$theme.children item=child} I want to examine ALL the properties of the object 'child' (I'm trying to find out at that level what 'type' the child is, i.e. image, audio etc..... A simple thing from my php experience would be print_r( $child ) but of course php doesn't know about the $child variable! What is the smarty equivalent? any ideas? OR, and other cool way to find out the attributes of that object at this level? Thanks in advance! |
|
Photographicon
![]()
Joined: 2006-01-05
Posts: 40 |
![]() |
{$child|print_r} should do that... see http://codex.gallery2.org/index.php/Gallery2:Tpl_Reference LITL.W/L |
|
rsoul
![]()
Joined: 2006-01-27
Posts: 6 |
![]() |
Great thanks - I knew there was a way! However, I notice that prints out the VALUES of the array but not the key names (listtags) - is there a way to tell print_r to show the values AND the tags, just like in php? thanks again. |
|
Photographicon
![]()
Joined: 2006-01-05
Posts: 40 |
![]() |
Not sure how to do this for a single array, but turning on the Gallery debug feature will dump all variables and show key/value pairs for arrays. Do one of: * edit /config.php - change "$gallery->setDebug(false);" to "$gallery->setDebug('buffered');" The former will give you more subsidiary information, the latter will give you more control over when the debug dump occurs. LITL.W/L |
|