Difference between Smarty 2.x and 3.0 :

Smarty 3 is PHP 5 only. It will not work with PHP 4.

1. Smarty 3 allows expressions almost anywhere :

Example :

			{$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]}
                    
2. Arrays can be nested :
SYNTAX

{assign var=foo value=[1,[9,8],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.

Example :

			{$foo['bar']=1}{$foo['bar']['blar']=1}
                
3. While Loop :
Example :
			{while $foo}...{/while}
			or
			{while $x lt 10}...{/while}                    
                
4. Direct access to PHP functions :
Example:
			{time()}
                
5. There is a new {function}...{/function} block tag to implement a template function:

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.

6.for, forelse loop :
Example:
{for $foo=1 to 3 }
   {$foo}
{/for}
                
7. $smarty.current_dir returns the directory name of the current template.
8. Scope of Special Smarty Variables :

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.

Example :
{include file="path/foo.tpl" index=$smarty.section.foo.index}