News Feed
Sections




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

Matthew Weier O'Phinney's Blog:
Using Action Helpers To Implement Re-Usable Widgets
October 05, 2010 @ 09:12:19

Matthew Weier O'Phinney has a new post to his blog today showing you how to use action helpers to make widgets that you can reuse all over your Zend Framework application. His method doesn't use the "action()" helper, either.

The situation all started when Andries tweeted asking about what he considered some mis-behavior on the part of the action() view helper -- a situation that turned out not to be an issue, per se, but more a case of bad architecture within Zend Framework. [...] The helper was done this way because Zend Framework does not render views a single time -- it instead renders after each action, and accumulates views to render in the layout.

Instead, he offers action helpers as a solution. He gives an example of a user module that has views, helpers and forms but no controllers, including a Bootstrap file. This bootstrap defines the helpers, configuration file and adds the helpers into the process flow of the application. Once things are all set up and the action helper is created, adding the module to a page is as easy as calling "createProfileWidget()" into a partial view.

1 comment voice your opinion now!
action helper zendframework widget reuse tutorial


blog comments powered by Disqus

Similar Posts

The Bakery: Simple way to memcache (almost) all database queries

DevShed: Introducing the Facade Pattern in PHP 5

Matthew Weier O'Phinney: RESTful APIs with ZF2, Part 1

PHP-Security.net: Suhosin 0.9.34-DEV Installation HowTo

PHP-Tip-a-Day: PHP Tutorial: The Allegory of The Factory Pattern


Community Events





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


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

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