How do you print all variables available in the context of a Smarty template? Something like the Django debug trace that lists everything being passed.
Thanks
Variables in Smarty can be either displayed directly or used as arguments for functions, attributes and modifiers, inside conditional expressions, etc. To print a variable, simply enclose it in the delimiters so that it is the only thing contained between them.
You can assign a variable to root of the current root tree. The variable is seen by all templates using the same root tree. A global variable is seen by all templates. To access {assign} variables from a php script use getTemplateVars() .
Use {debug}
From the manual:
{debug}
dumps the debug console to the page. This works regardless of the debug settings in the php script. Since this gets executed at runtime, this is only able to show the assigned variables; not the templates that are in use. However, you can see all the currently available variables within the scope of a template.
$debugging = true
must be enabled in your settings or class, and site popups must be unblocked to see the window
var_dump($Smarty->_tpl_vars);
From the Smarty code :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With