Tutorial Series
Twig is a flexible, fast, and secure template engine for PHP. This series covers the basics of Twig installation, setup, and usage.
Tutorial
Published on September 11, 2013
If a PHP file becomes more complex (and it will for any application), you will have a big problem with managing the layout of your site. If you want a designer to work with it, this designer will have to search into this file which is what we want to prevent. So the solution is the separation of the presentation (layout) from the logic (programming) and the best way to do it is by using a template engine such as Twig.
Tutorial
Published on September 12, 2013
Twig is a very good alternative to the PHPTemplate way of building the presentation logic of a web application as it is represents a much cleaner templating experience. In this respect, it comes with a very easy to understand syntax and restricts you from performing dynamic PHP operations in template files.
In the previous tutorial, we’ve seen how to set up Twig with Composer. In this tutorial, we will dive a bit deeper into its syntax and how you can use it to build up your template files.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.