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
The reason that $php_var is 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.
Instead of opening and closing {php} tags. You could try,
{php}
$php_var = $this->get_template_vars('your_smarty_var_name');
echo $php_var;
{/php}
加载中,请稍侯......
精彩评论