Ah, interesting.  With one small tweak to set the action, this seems to work:

    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $frontController = Zend_Controller_Front::getInstance();
        $isDispatchable  =
$frontController->getDispatcher()->isDispatchable($request);

        if (!$isDispatchable) {
            $controller = 'root';
            $action = $request->getControllerName();

            $request->setControllerName($controller);
            $request->setActionName($action);
        }
    }


jkendall wrote:
> 
> 
> rutt wrote:
>> 
>> Basically, if the first element of the path is a valid controller, then
>> the request should be dispatched to that controller.  If not, it should
>> be dispatched to RootController.  
>> 
> 
> Not sure if this will get you where you want to go, but my first thought
> was setting up a plugin to test whether or not a request was dispatchable,
> and setting the controller to 'root' if it isn't dispatchable.
> 
> class My_Controller_Plugin_Example extends Zend_Controller_Plugin_Abstract
> {
>   
>   public function preDispatch(Zend_Controller_Request_Abstract $request) {
>     
>     $frontController = Zend_Controller_Front::getInstance();
>     $isDispatchable  =
> $frontController->getDispatcher()->isDispatchable($request);
> 
>     if (!$isDispatchable) {
>       $controller = 'root';
>       $request->setControllerName($controller);
>     }
>     
>   }
> }
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Routing%3A-actions-as-first-element-of-path-tp20908784p20918121.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to