Which is the best web template engine

Separate - With open source for better programming.

We all agree on one point: For a successful website or web-based application, you need high-quality content and high-quality design. Because only if the topic of a web offer is exciting can the interest of the visitors be aroused. The same applies to the design: a chic interface design often determines the success or failure of a project. After all, the overall impression is the first thing the user sees.

But what about the programming? One thing is clear: the website or application must work. However, a good template is more than content and a working design - the quality of the source text also plays an important role.

But how can "clean programming" be made easier?
How can the code be made lean and clear?

Separate template engine

The Open Source Separate Template Engine for PHP, "Separate" for short, is a successful way to achieve this goal. Here business logic and presentation layer are separated from one another. The separation of data and presentation enables a clear structure of the underlying source text, which increases readability and efficiency. The generation of finished HTML pages is automatically managed by the template engine.

Architecture of Separate

The focus of the development of Separate is on the dynamic expansion of functions (such as Value Formatter or the inheritance option of the SeparateTemplate class). Particular care was taken to ensure that the separate one works independently of other libraries (such as Pear, ...) and that it can also be expanded with its own functionalities.

Only the SeparateTemplate.php file (from PHP 5) is required to integrate the engine.

require_once ‘./SeparateTemplate.php’;

Then a template file will be loaded. The SeparateTemplate.loadSourceFromFile (…) method is used for this.

$ t = SeparateTemplate :: instance () -> loadSourceFromFile (‘./ index.htm’);

After the template file has been successfully loaded, the actual implementation, such as B. the assignment of values ​​to certain template variables take place.

$ t-> assign (‘MY_VARIABLE’, ‘my value’);

The subsequent generation of the HTML page takes place with the SeparateTemplate.display () method.

$ t-> display ();

Building a separate-based application

The separate system is kept very simple. In principle, applications that are based on separate consist of a presentation layer and the business logic. While the former consists of HTML source text and template variables, the calculations are carried out in the business logic (e.g. reading out the data from the database) and the generated values ​​are assigned to the template variables.


The implementation of the separate template engine and thus the separation of data and display is simple and useful. It is also useful that variables are declared in one place and can be used as often as required in the source text (principle of locality). This means that cross-document changes can be implemented using a single code point. The time saved with complex templates can be enormous.

Since the php template engine is also open source, in my opinion it is worthwhile for every programmer to take a look at the concept of Separate.

Further information at: http://de.separate.esud.info/