The way you're doing it is probably the best. The only other alternative I can think of is to have another plugin at routeShutdown() which only registers the plugin for select controllers. That seems to be a more convoluted solution than to just have your plugin's code determine if it should do anything. The controller is not known untill after routing has taken place.
On Wed, Mar 24, 2010 at 1:07 PM, Jurian Sluiman <subscr...@juriansluiman.nl> wrote: > On Wednesday 24 Mar 2010 17:27:06 asagala wrote: >> I currently have a FrontController plugin that extends >> Zend-Controller_Plugin_Abstract. The preDispatch function is implemented in >> it. Everything works except for one thing. How can I prevent the >> preDispatch function to be applied to certain controllers? The only way I >> have right noew is to use $this->getRequest()->getControllerName() and >> compare it to a list of controller names. >> >> Is there a better/easier way? > > I can think of two options, but both not ideal. The first one is using the > routeShutdown to fetch the route (and thus controller) and based on that info > turn the plugin on or off. > > The second is the option you use the controller's preDispatch() method. To > avoid DRY the code inside the method could be replaced with an action helper. > > Furthermore, I have no idea... > Regards, Jurian > -- > Jurian Sluiman > CTO Soflomo V.O.F. > http://soflomo.com > -- A.J. Brown Software Engineer, ZCE blog : http://ajbrown.org talk : (937) 540-0099 chat : IntypicaAJ