What is a template engine?

A template engine is a library or framework that separates logic from template files. These libraries provide their own syntaxes for passing necessary values to the template from the controllers or models. Once successfully implemented, we should only have simple if-else statements and loops inside the template files and there shouldn't be any complex code.

There are plenty of open source template engines available for PHP. Smarty, Mustache, and Twig are some of the popular ones amongst them. Throughout this book, we will be using the Twig templates engine created by SensioLabs. If you are not familiar with template engines, I suggest you look at the Twig documentation at http://twig.sensiolabs.org/documentation.

Now let's ...

Get WordPress Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.