This sounds like a good use for a controller plugin. Instead of adding a new
route, you can simply modify the request:

class MyPlugin extends Zend_Controller_Plugin_Abstract
{
    public function dispatchLoopStartup(Zend_Controller_Request_Abstract
$request)
    {
        if (<some condition>)
        {
            $request->setController('someController')
            $request->setAction('someAction');
        }
    }

--
Hector


On Mon, Feb 22, 2010 at 2:22 PM, Alex Howansky <[email protected]>wrote:

> I want to add a conditional to my bootstrap that, if some check is true,
> sends all traffic, regardless of the request, to a specific
> controller/action.
>
> Right now, I'm overriding all the previously defined routers with a
> wildcard that catches everything:
>
> public function _initSite()
> {
>    <existing initialization>
>
>    if (<some condition>) {
>        $override = new Zend_Controller_Router_Route(
>            '*', array('controller' => 'my_con', 'action' => 'my_act')
>        );
>        $this->getResource('FrontController')
>             ->getRouter()
>             ->addRoute('override', $override);
>    }
>
> }
>
> This seems a rather roundabout way of doing it. Am I missing something more
> obvious?
>
> Thanks,
>

Reply via email to