And here is the first part of our "Smarty Template engine for CMS" introduction.


Smarty processes data and templates in two steps, what increases the speed massive:

  • At first a new PHP file is generated from the PHP-Code and the HTML template, which covers a mix-up of HTML and PHP, which otherwise would have been written by the developer without using Smarty templates. This temporary PHP file will only be recreated, when one of the smarty templates changes, so the template is not parsed for every single page call.
  • If required Smarty can save the finally HTML output. That said, your webserver serves practically a static website for every request, what brings a performance boost especially for PHP applications using multiple database queries. For webapplications normally there are less database updates than database queries, therefor the developer case has to consider, that in this case (after a database update) the cache needs to be flushed/deleted.
    For BIGACE we did not yet implement this caching strategy yet, but this task is one of the next that we will look at for the next release (2.6).


The advantages of smarty are primarily based on the fact, that dynamic and static parts can be mixed up free, where the PHP code only needs to pass the required data to the Smarty template engine.

A complete isolation between the code which prepares the data and the one that creates the layout with smarty is achieved. The presentation can be completely changed this way without the need to change the application code.

Smarty can be extended by own plugins easily, which add special functionality to your system.

A lot of default tasks, like the creation of select-boxes and filtering of strings can be achieved more easily.


Among other things one of the biggest criticisms is, that PHP already is a template-engine and with the use of smarty the learn curve increases, the complexity rises and the performance suffers.

Smarty does not separate between logic and display as it is often dicussed, but it gives us an efficient way of mixing up static and dynamic content.

Another critic point is the little support of the PHP5 OO-features like method chaining.
This point if one of the biggest issues I have as well with Smarty: Working with complex data, this can be a pain in the developers ... fingers ;-D


This conclusion is our point of view. Smarty is a great chance to tie designers and developers together. Especially in Content Management Systems its a chance for unexperienced users to change their website templates, without messing around with the PHP side. Smarty TAGs are much easier to understand and customize than any PHP statement could ever be.

For BIGACE users there is still the choice between PHP and Smarty templates, but I recommend using Smarty. They are better portable and you do not have to mess with the PHP API. For further information, our Smarty TAGs are documented in the bigace documentation wiki.