tags:

views:

35

answers:

2
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

+1  A: 

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}
mbenegas
+2  A: 

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.

Borealid