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()

Site development

About Saurus API / Creating page template tutorial / Creating content template tutorial / Applying custom design to page template checklist / Site and Article editor CSS styles / Using PHP in templates / Exchanging variables between templates and PHP / Profiles and Custom Assets / Site languages / Printer friendly pages / Site cache / Page compression / Enabling browser cache / Creating WAP pages / Configuring sitemap / Saurus 4.1 technical notes