Some time ago I saw a web page where they implemented a really nice plugin to allow master pages for the views. I extended it a bit a here is the result. Is an example of a Controller_Plugin =).
atte. JoaquĆn Bravo On 9/24/06, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
On 9/24/06, Ralf Eggert <[EMAIL PROTECTED]> wrote:
> the plugins for the Zend_Controller are not documented yet. How can I
> use the plugins and when does it make sense to use them? Has anybody got
> an example?
Create a class that implements Zend_Controller_Plugin_Interface. The
following methods would need to be implemented:
* routeStartup() - executed just before the router determines the
requested route to dispatch
* routeShutdown() - executed just after the route has been
determined
* dispatchLoopStartup() - executed before any actions are dispatched
* dispatchLoopShutdown() - executed after all actions have been
dispatched
* preDispatch() - executed just prior to executing a single action
* postDispatch() - executed just after execution of a single action
You can also create your own plugin events. Simply create your own
plugin broker by extending Zend_Controller_Plugin_Broker, and adding
methods for your own plugin dispatchers. A typical method might look
like:
public function myCustomAction()
{
foreach ($this->_plugins as $plugin) {
$plugin->myCustomAction();
}
}
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend Technologies | http://www.zend.com/
Layout.php
Description: application/php
