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/

Reply via email to