Smarty 3 is PHP 5 only. It will not work with PHP 4.
{$x+$y} will output the sum of x and y. {$foo = strlen($bar)} function in assignment {assign var=foo value= $x+$y} in attributes {$foo = myfunct( ($x+$y)*3 )} as function parameter {$foo[$x+3]}
NOTE : You can assign a value to a specific array element. If the variable exists but is not an array, it is converted to an array before the new values are assigned.
{$foo['bar']=1}{$foo['bar']['blar']=1}
{while $foo}...{/while} or {while $x lt 10}...{/while}
{time()}
There is a new {function}...{/function} block tag to implement a template function: This enables reuse of code sequences like a plugin function.It can call itself recursively. Template function must be called with the new {call...} tag.
{for $foo=1 to 3 } {$foo} {/for}
In Smarty 2 the special Smarty variables $smarty.section.* and $smarty.foreach.* had global scope. If you had loops with the same name in subtemplates, you could accidentally overwrite values of a parent template. In Smarty 3 these special Smarty variables now have local scope in the template which is defining the loop. In the rare case you need these values in a subtemplate, you have to pass them as parameters.
{include file="path/foo.tpl" index=$smarty.section.foo.index}