Friday, April 4, 2008

Smarty Templates Engine

It was common practice to mix the PHP Script and HTML tags while coding in PHP. This resulted in a complex code which was difficult to understand and inconvenient to update. This problem was solved by Smarty which makes PHP scripts independent of layout.
Smarty is templates engine for PHP. It provides a way to separate programming logic from contents and presentation. It enables templates designers and programmers to work independently. Smarty templates can contain logic which is only for presentation purpose. Its unique feature is template compiling; it reads templates files and create PHP scripts from them. Once they are created, then they executed from there. This is what makes Smarty efficient.


· Fast and efficient.
· No templates parsing overhead (Compile once).
· The if/else constructs are passed to PHP parser.
· Nesting of sections like if/else.
· Built-in caching support.
· Arbitrary template sources.
· Custom cache handling functions.
· Plug-in architecture.

No comments: