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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access