A work around could be to not specify the modules directory but instead specify the controller directory of the module in question (in Application/Bootstrap) - in this case each module would have their own bootstrap (index.php) script and the current module name could be specified in a respective config file - so potentially there would be two bootstrap classes executed, one for the Application/Bootstrap and then the respective Module/Bootstrap.
On Wed, Dec 16, 2009 at 4:40 PM, Hector Virgen <[email protected]> wrote: > You can test the request from within your plugin: > public function dispatchLoopStartup(Zend_Controller_Request_Abstract > $request) > { > if ('admin' != $this->_request->getModuleName()) { > return; > } > // Perform pluginy things here > } > > -- > Hector > > > On Wed, Dec 16, 2009 at 2:18 PM, Guillaume ORIOL <[email protected]> wrote: >> >> Thank you Matthew but I don't understand your last remark. >> >> Let's say I have two modules, each of which has its own plugin registered >> at bootstrap: >> class Default_Bootstrap extends Zend_Application_Module_Bootstrap >> { >> public function _initPlugin() >> { >> $plugin = new Plugin_Foo(); >> $front = Zend_Controller_Front::getInstance(); >> $front->registerPlugin($plugin); >> } >> } >> >> class Admin_Bootstrap extends Zend_Application_Module_Bootstrap >> { >> public function _initPlugin() >> { >> $plugin = new Admin_Plugin_Bar(); >> $front = Zend_Controller_Front::getInstance(); >> $front->registerPlugin($plugin); >> } >> } >> >> If I perform a request on the default module, both plugins are executed. >> According to your last remark, I thought only one plugin should have bee >> executed. >> -- >> Guillaume >> >> Le 16/12/09 21:54, Matthew Weier O'Phinney a écrit : >>> >>> -- Guillaume ORIOL<[email protected]> wrote >>> (on Wednesday, 16 December 2009, 09:33 PM +0100): >>> >>>> >>>> I wonder why, in a modular application, all module bootstraps are >>>> executed during initialization and not only the one corresponding to >>>> the matched module? >>>> >>>> What would be the way to get only one of them executed (I would like >>>> to connect a different plugin to each module)? >>>> >>> >>> All module bootstraps are executed... because at bootstrap time, the >>> requested module is not yet known. (It happens during _routing_.) >>> >>> Module bootstraps should be used for: >>> >>> * Setting up autoloading of module resources (happens already, >>> automatically) >>> >>> * Performing any module-specific tasks that need to happen on every >>> request >>> >>> * Registering module-specific plugins >>> >>> This latter area is where you should execute code that should only be >>> executed if the module is the one requested. >>> >> >> > > -- Greg
