Smarty
Smarty is a template engine written in PHP. Using Smarty, you can easily and cleanly separate your PHP back-end code from the front-end output, which makes your code much cleaner, more readable and thus managable.
Installation
Installing Smarty is pretty simple:
Understanding the File StructureYour PHP files can be located anywhere under the Document Root, like how you normally do without Smarty. The templates/ directory is where you create your Smarty files in. A Smarty file is basically just an HTML / XHTML file, with some Smarty variables in it. Normally we use .tpl extension for Smarty file names. The templates_c/ directory is where Smarty put its "compiled" codes. You will never need to do anything to this directory (other than making sure it exists and readable and writable by the web server). |