News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Extending Twig Templates:
Inheritance, Filters, and Functions
April 16, 2013 @ 11:05:22

On PHPMaster.com today there's a new tutorial for the Twig templating users out there showing you how to extend your templates via inheritance, filters and functions - all abilities already built in to the tool.

When working within an MVC architecture, it's common to use a template library to populate the dynamic content of our views. There are dozens of such libraries available for PHP, but Twig is one of the standouts because of the ability to extend core features with custom implementations. In this article we'll explore how Twig templates can be extended using template inheritance, filters, and functions.

He starts first with some of the common limitations of templating frameworks (extension) and how Twig gets around this. He shows the use of the "extends" keyword and the "block"/"endblock" for splitting up the page into reusable chunks. He also shows how to use filters and functions in your Twig tags, allowing for more customized content and functionality for your output.

0 comments voice your opinion now!
taig template tag filter function inheritance tutorial

Link: http://phpmaster.com/extending-twig-templates-inheritance-filters-and-functions/

blog comments powered by Disqus

Similar Posts

DevShed: Unit Testing in Detail

Sébastien Thomas' Blog: Monitoring PHP APC cache usage

Sudheer Satyanarayana's Blog: XML RPC Client Using PHP PEAR - A Real World Example: Ping Technorati

Matthew Weir O'Phinney's Blog: Cgiapp2 Tutorial 1 - Switch Template Plugins at Will

DevShed: Building an Image Generator Class with PHP 5


Community Events





Don't see your event here?
Let us know!


community tips language api laravel interview framework opinion podcast list package release deployment introduction zendserver update install library symfony series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework