Hi,

I had the same problem a couple of weeks ago. Please have a look into
this discussion.

http://www.nabble.com/Default-controller-is-not-set-tf2746286s16154.html

Anyway, I created a plugin which simulates the old behavior. You
probably need to reformat the piece of code.

  class Plugin_Notfound extends Zend_Controller_Plugin_Abstract
  {
      public function preDispatch($request)
      {
          $dispatcher = Zend_Controller_Front::getInstance()
                        ->getDispatcher();

          if (!$dispatcher->isDispatchable($request))
          {

$request->setControllerName($dispatcher->getDefaultController())
                      ->setActionName('noroute')
                      ->setDispatched(false);
          }
      }
  }

Another solution is to handle the thrown exceptions in a custom
Zend_Controller_Response object by overwriting the __toString() method.

And finally you could create your own router to handle this (code copied
from Matthews mail):

    class My_Controller_Router extends Zend_Controller_Router
    {
        public function route($request)
        {
            parent::route($request);

            $dispatcher =
Zend_Controller_Front::getInstance()->getDispatcher();
            if (!$dispatcher->isDispatchable($request))
            {

$request->setControllerName($dispatcher->getDefaultController())
                        ->setActionName($dispatcher->getDefaultAction());
            }
        }
    }

Hth!

Best Regards,

Ralf



Reply via email to