Exchanging variables between templates and PHP
Assigning varibales from PHP into the template code
{php}
$variable = 'variable content';
$this->assign('SmartyVarsAreCaseSensitive', $variable);
{/php}
From PHP: {$SmartyVarsAreCaseSensitive}
Relevant pages from Smarty documentation: assign() and assign_by_ref()
Using template variables in PHP
{assign var="SmartyVarsAreCaseSensitive" value="variable content"}
Smarty template variable: {$SmartyVarsAreCaseSensitive}
<br>
{php}
$variable = $this->get_template_vars('SmartyVarsAreCaseSensitive');
echo 'Smarty template variable in PHP: ';
echo $variable;
{/php}
Relevant pages from Smarty documentation: get_template_vars()
RSS