There are several benefits to using a templating system such as Smarty. They include but are not limited to:
Separating the program code from the presentation layer.
Preventing template editors from modifying program code.
Removing the need for programmers to design page layout.
Allowing the redesign of a web page without modifying any program code.
Enabling multiple “skin” designs with little recourse to modifying program code.
To pass a variable to a Smarty template, a PHP program uses
Smarty templates access variables passed to them by
prefacing them with a dollar sign
$ and enclosing them with curly braces
To iterate through an array in a Smarty template, you use
If Smarty has been installed, you can enable it in a PHP program by including the Smarty.class.php file from its correct location (normally in a folder called Smarty, just under the document root).