php - Module-specific Controller plugins in Zend Framework -
my zend framework project divided modules. each module has specific controller plugins.
now, problem all plugins loaded , registered (and thus, called) - no matter module user trying access.
i could test in module , stop execution directly in plugins, have in each , every plugin...
is there elegant way register module-specific plugins? or trying solve wrong problem here?
this example of module specific plugins
taken http://weierophinney.net/matthew/archives/234-module-bootstraps-in-zend-framework-dos-and-donts.html
class foomodule_plugin_layout extends zend_controller_plugin_abstract { public function dispatchloopstartup(zend_controller_request_abstract $request) { if ('foomodule' != $request->getmodulename()) { // if not in module, return return; } // change layout zend_layout::getmvcinstance()->setlayout('foomodule'); } }
update: in case missed , there other ways listed in same article above :
isn't there better way this?
yes, there better ways accomplish this. true problem modules second-class citizens in zf currently. there few neat ideas floating around: kathryn's active module config
Comments
Post a Comment