{assign} {assign} is used for assigning template variables during the execution of a template. Attribute Name Type Required Default Description var string Yes n/a The name of the variable being assigned value string Yes n/a The value being assigned {assign} The above example will output: {assign} with some maths This complex example must have the variables in `backticks` Accessing {assign} variables from a PHP script To access {assign} variables from a php script use get_template_vars(). Here's the template that creates the variable $foo. The template variables are only available after/during template execution as in the following script. get_template_vars('foo'); // fetch the template to a variable $whole_page = $smarty->fetch('index.tpl'); // this will output 'smarty' as the template has been executed echo $smarty->get_template_vars('foo'); $smarty->assign('foo','Even smarter'); // this will output 'Even smarter' echo $smarty->get_template_vars('foo'); ?> ]]> The following functions can also optionally assign template variables. {capture}, {include}, {include_php}, {insert}, {counter}, {cycle}, {eval}, {fetch}, {math}, {textformat} See also assign() and get_template_vars().