Hi mbneto, On Mon, Nov 7, 2011 at 12:11 AM, mbneto <[email protected]> wrote: > > So my questions are: > a) Where should I add this registerPlugin since in my index.php I am not > actually calling the dispatch? >
You can register plugins in your application.ini file, see the manual: http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.frontcontroller It will come done to something like this: resources.frontController.plugins.foo = "My_Plugin_Foo" > b) My plugin could be like this? > > class MyPlugin extends Zend_Controller_Plugin_Abstract { > public function routeStartup(Zend_Controller_Request_Abstract $request) { > > $frontController = Zend_Controller_Front::getInstance(); > $router = $frontController->getRouter(); > // Get the info from the db > foreach ($dbInfo as $info) { > $route = new Zend_Controller_Router_Route ( > 'something/', > array('controller' => 'real-controller', > 'action' => 'index', > 'id' => X)); > > $router->addRoute('something', $route); > } > Something like that would work yes. During route startup you get the router, all the routes and inject them. The router will find a match with a pool including these routes. -- Jurian Sluiman
