smarty file
{php}
some php code...
$php_var = "{/php}{$smarty_var}{php}";
echo $php_var;
some php code ...
{/php}
smarty file
Why ‘$php_var’ value is: ?>
How get $smarty_var value?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason that
$php_varis wrong is because you accidentally closed your{php}when you put a{/php}in the PHP code there. Smarty doesn’t understand enough to care that it’s in a quoted string.To actually get the smarty variable, use
$this->get_template_vars('smarty_var')somewhere in your ‘{php}’ block.Alternately, split the template into two smaller ones invoked in sequence.