News Feed
Jobs Feed
Sections




Recent Jobs

News Archive
Rob Allen's Blog:
Hooks in Action Helpers
November 05, 2008 @ 09:34:40

Rob Allen has posted this look at using hooks inside of action helpers (a follow-up from his previous article on action helpers):

Hooks are a feature of action helpers that allow you to automatically run code at certain points in the dispatch cycle. Specially, there are two hook functions available for action helpers: preDispatch and postDispatch. These allow you to ensure that some functionality is always run for each request.

He creates a simple action helper that grabs a random quote from an array and drops it into a property of the helper. By defining a preDispatch method inside of the helper, the HelperBroker knows to pull the method in an execute it immediate before the rest of the actions are executed. A calls to addHelper with the hooks defined is all it takes to glue it together with the execution.

0 comments voice your opinion now!
hook action helper random quote tutorial addhook helperbroker zendframework



Similar Posts

WebReference.com: Globalize your Web Applications: PHP's Locale Package

WebReference.com: XML and PHP Simplified - Formatting XML Documents

Learn.IIS.net: Build a High-Performance PHP Stack with Windows IIS and Zend Server

Oracle Technology Network: Oracle Database 10g Express Edition and Zend Core for Oracle

LotsOfCode.com: Tag Cloud Tutorial


Community Events









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


zendframework conference drupal podcast framework extension opinion microsoft wordpress symfony windows developer release job codeigniter hiphop facebook apache performance feature

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