Book Image

WordPress Web Application Development

By : Rakhitha Nimesh Ratnayake
Book Image

WordPress Web Application Development

By: Rakhitha Nimesh Ratnayake

Overview of this book

Table of Contents (19 chapters)
WordPress Web Application Development Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

What is a template engine?


The 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 shouldn't have complex code inside template files other than simple if-else statements and loops.

There are plenty of open source template engines available for PHP. Smarty, Mustache, and Twig are some of the popular ones among them. However, integrating this type of template engine in WordPress is a complex task, compared to using it in other PHP frameworks. The architecture of WordPress is different from any other PHP framework as it drives on action hooks and filters. Therefore, the integration needs to be capable of handling WordPress-specific things such as actions, filters, widgets, template tags, and so on.

Note

The Twig templates engine created by SensioLabs is one of my favorites as it offers many unique features compared...