That would work too :) -- Hector
On Mon, Feb 22, 2010 at 4:50 PM, Alex Howansky <[email protected]>wrote: > > This sounds like a good use for a controller plugin. Instead of adding a >> new route, you can simply modify the request: >> > > Hmm, unfortunately my conditional is dependent on some of the other > initialization logic in the bootstrap. So, in order to use this technique, > I'd have to pass those dependencies to the plugin constructor for temporary > storage there, which seems rather roundabout as well. Perhaps a combination > of the two methods would work better. I could write a generically useful > "goto" plugin that simply takes a controller/action to always override the > current request with: > > class App_Controller_Plugin_Override > > extends Zend_Controller_Plugin_Abstract > { > > protected $_action = null; > protected $_controller = null; > > public function __construct($controller, $action) > { > $this->_controller = $controller; > $this->_action = $action; > } > > public function dispatchLoopStartup($request) > { > $request->setControllerName($this->_controller); > $request->setActionName($this->_action); > } > > } > > And then keep my conditional in the bootstrap, and only register the plugin > when it fires: > > if (<conditional>) { > $front->registerPlugin( > new App_Controller_Plugin_Override('my_con', 'my_act') > ); > } > >
