News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
Zend Developer Zone:
Integrating Smarty with the Zend Framework
April 05, 2006 @ 07:22:43

For anyone that's using or wanted to use Smarty in the future and has been looking into the Zend Framework, you might have hesitated until you know how to tie them both together. Well, wait no more! This new post from the Zend Developer Zone shows you exactly how.

Inspired by this article I started to play around a bit to integrate the Smarty template engine into the Zend Framework. My ambition was to minimize the required code in the controller actions but stay close to the given Zend_View API. I also wanted to integrate the Smarty caching feature. Here is the code I came up with.

He sets up a directory under his Zend library include path for the templates to live in and starts writing code. The first step is a class that's based off the Zend_View_Abstract class to set the initial Smarty variables. He follows this up with serveral methods - __run, assign, and escape before displaying the results with output().

Finally, he gives an example of how to use the class he's created to spit out a Smarty template with all of the data nicely in place.

More information on the Zend Framework can be found at framework.zend.com, and information on Smarty at smarty.php.net

0 comments voice your opinion now!
php zend framework integrating smarty view output assign escape php zend framework integrating smarty view output assign escape



Similar Posts

Lukas Smith\'s Blog: A Perspective on the Zend/Eclipse PHP IDE

Professioanl PHP Blog: Building a culture of objects in PHP

Mike Naberezny\'s Blog: pecl/operator and Other Neat Stuff

PHPKitchen: Seagull 0.6.1 Released

Dave Dash's Blog: Dynamically adjusting your page title in symfony


Community Events









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


example job ajax releases zend cakephp package developer mysql release security database conference application PEAR PHP5 zendframework framework book code

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