News Feed
Sections




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

Ryan Mauger's Blog:
Using Twig with Zend Framework
May 05, 2011 @ 08:28:18

Ryan Mauger has written up a new post about an integration he's done using the Twig templating engine (from be Symfony community) with his Zend Framework application to make view handling simpler.

Mostly I thought [what Twig offered] were silly things that were not really needed unless you had a team of designers to work with, however, during my exploration, a couple of things occurred to me that I had not considered about templating systems before. One being the enforced separation of concerns they provide; you simply cannot do anything from inside them which you shouldn't be, keeping your presentation very very clean. The second, being that they're not all as terrible as Smarty.

He helps you get Twig installed (via PEAR chnnel) and includes the code for an application resource and the changes you'll need to make to your application.ini to get things working. He uses a base controller setup, so he shows how to introduce a "twig()" method into that to help with rendering. Finally, there's a sample class included that includes two actions, both using this "twig()" method to pas the output data through the twig interpreter and out to the view.

1 comment voice your opinion now!
twig templating tutorial zendframework example pear


blog comments powered by Disqus

Similar Posts

Ulrich Kautz: PHP Validation & Sanitization

Cyberlot's Blog: PHP bugs, whos responsible? Do they even read them?

DevShed: Main Methods of the DirectoryIterator Class in PHP 5

Greg Beaver\'s Blog: Why it is very important to upgrade to PEAR 1.4.6 from PEAR 1.3.x

PHPMaster.com: Creating Web Services with PHP and SOAP, Part 2


Community Events





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


library bugfix api podcast laravel list developer zendserver tips deployment threedevsandamaybe community opinion language series release introduction symfony interview framework

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