News Feed
Sections




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

Zend Developer Zone:
Creating Web Page Templates with PHP and Twig (part 1)
April 07, 2011 @ 12:44:43

On the Zend Developer Zone today there's a new tutorial from Vikram Vaswani about using the Twig templating engine in your application. It's part one of a series that introduces the library to you and includes examples of some of the most common templating logic.

Most PHP frameworks, including Zend Framework, Agavi, CakePHP and CodeIgniter, come with built-in templating to enable this separation. However, if you're not a big fan of frameworks, or if your project is small enough that you don't need the additional overhead, you can also consider using a standalone template engine to obtain the same benefits. A number of such engines exist - you've probably already heard of Smarty, Savant, Dwoo and others - and in this article, I'll introduce you to one I discovered rather recently, called Twig.

The Twig project gives you a framework-independent tool for creating simple (or complex, if you'd like) templates for the output of your site. He shows you how to get it installed (via PEAR) and provides some sample templates for things like:

  • using conditionals (if/else/etc)
  • looping
  • working with arrays from PHP
  • including other templates
  • using included filtering on data
0 comments voice your opinion now!
tutorial twig templating introduction


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Create a Unit Conversion Application w/the Zend_Measure Component

NETTUTS.com: How to Paginate Data with PHP

NetTuts.com: Deploying a Laravel Application Using Capistrano

PHPBuilder.com: PHPUnit Fundamentals: Setting Up and Tearing Down a Doctrine 2 Database

PHPMaster.com: Under the Hood of Yii's Component Architecture, Part 3


Community Events





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


opinion install series release testing community laravel threedevsandamaybe language code refactor podcast developer symfony2 unittest interview introduction list configure framework

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