Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Templating Engine Pros and Cons with Zend Framework

I am getting familiar with Zend Framework (and MVC with PHP in general) for a personal project. I have previous experience with Smarty and have no major gripes with it, but I would like to use this project as a good in-depth learning exercise. Those of you familiar with different templating engines and ZF: Do you believe there are better templating engines than Smarty in conjunction with ZF and why? I would like to apply what I learn to the real world and production environments.

The personal project will be fairly robust. User management, sessions, security, database interaction, form input, jQuery, etc.

like image 404
ashurexm Avatar asked May 13 '10 01:05

ashurexm


1 Answers

If you are using this project as a learning experience, I would suggest learning and using Zend_View, which is the templating (for want of a better word) part of ZF. This will be much simpler than trying to use any third party template engine, and Zend_View can do everything Smarty can.

In my personal opinion there are only two good reasons to use a separate templating language in ZF (or any PHP project):

  1. You need non-programmers to be able to edit and use the templates
  2. You need compatibility with existing templates written using that templating engine (e.g. Smarty templates from an existing project, or templates used by another non-PHP project)

If you do go down the Smarty route, the Zend_View part of the ZF manual has some Smarty examples: http://zendframework.com/manual/en/zend.view.scripts.html . There is also this tutorial on DevZone: http://devzone.zend.com/article/120 although it's a few years old now.

like image 174
Tim Fountain Avatar answered Sep 24 '22 13:09

Tim Fountain