I have some variables inside a template and I don’t know where I assigned them. I need to know what is inside a particular variable; for instance, say I have a variable in smarty called member
. I tried with {debug}
but it didn’t work, and no popup was shown.
How can I output/debug smarty variables using something like var_dump()
inside the templates?
Advertisement
Answer
You can use {php}
tags
Method 1 (won’t work in Smarty 3.1 or later):
{php} $var = $this->get_template_vars('var'); var_dump($var); {/php}
Method 2:
{$var|@print_r}
Method 3:
{$var|@var_dump}