Chapter 1. What is Smarty?

Smarty is a template engine for PHP. More specifically, it facilitates a manageable way to separate application logic and content from its presentation. This is best described in a situation where the application programmer and the template designer play different roles, or in most cases are not the same person.

For example, let's say you are creating a web page that is displaying a newspaper article.

One design goal of Smarty is the separation of business logic and presentation logic.

One of the unique aspects about Smarty is the template compiling. This means Smarty reads the template files and creates PHP scripts from them. Once they are created, they are executed from then on. Therefore there is no costly template file parsing for each request. Each template can take full advantage of PHP compiler and cache solutions such as eAccelerator, ionCube mmCache or Zend Accelerator to name a few.

Some of Smarty's features: