-- Mark Wright <[EMAIL PROTECTED]> wrote
(on Saturday, 20 January 2007, 06:34 PM -0700):
> So I added a __call method to handle missing actions, but I still
> don't understand how to handle missing controllers. If the controller
> does not exist it does not fall back on the default controller. And
> idea on how to do this?

In 0.7.0, the dispatcher grabs the default controller if the requested
controller is not found -- the default controller is IndexController.

Last I checked, the tests for this showed it working.

I'm doing some modifications on the dispatcher now, and I'll double
check to make sure that this is fully supported.

> On 1/20/07, Jan Pieper <[EMAIL PROTECTED]> wrote:
> >I think if the Controller does not exists, the default controller (e.g.
> >IndexController) and the default action (e.g. indexAction) is called. If
> >the action-Method does not exists, you'll get an empty page or an
> >exception will be thrown because there is no noRouteAction any more. You
> >have to define your own noRouteAction. I created an My_Controller_Action
> >class that extends Zend_Controller_Action and added the magic __call
> >method to handle actions that does not exist. After that you have to
> >create your Controllers by extending My_Controller_Action and all
> >unhandled action-calls will be catched and you can redirect to another
> >place (could be bad if the action of called controller does not exists)
> >or you should output an "not found" page or something else.
> >
> >-- Jan
> >
> >
> >> Actually if your url requests a controller that does not exist, or a
> >> controller that does exist but an action that does not exist you do
> >> not get a 404 error because mod_rewrite sends everything to index.php.
> >>
> >> So how do you handle this? Throwing an exception or giving a blank
> >> page doesn't seem like a user friendly response when somebody enters
> >> the wrong url into their browser.
> >>
> >>
> >> Mark
> >>
> >> On 1/19/07, Andrey Korolyov <[EMAIL PROTECTED]> wrote:
> >>> If you get  / - you have indexFile
> >>> If you get /test.html - you have 200 response or 404
> >>>
> >>> Default controller like index file for web server.
> >>>
> >>> 2007/1/19, Mark Wright < [EMAIL PROTECTED]>:
> >>> > I don't understand why a default controller isn't being used. Here's 
> >my
> >>> code:
> >>> >
> >>> >
> >>> > $baseUrl = substr($_SERVER['PHP_SELF'], 0,
> >>> >                    strpos($_SERVER['PHP_SELF'], '/index.php'));
> >>> > $frontController = Zend_Controller_Front::getInstance();
> >>> > $frontController->setBaseUrl($baseUrl);
> >>> > $frontController->setControllerDirectory($path_to_root .
> >>> > 'application/controllers');
> >>> > $frontController->throwExceptions(true);
> >>> >
> >>> > $frontController->dispatch();
> >>> >
> >>> > If I go to / or /index it works fine. If I go to /aa it throws an
> >>> > exception because aaController.php doesn't exist. But I thought the
> >>> > default controller was index so that if there is no aa controller it
> >>> > would default to the index controller. What am I missing?
> >>> >
> >>> >
> >>> > Mark
> >>> >
> >>> > --
> >>> > Have fun or die trying - but try not to actually die.
> >>> >
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Andrey Korolyov | WEB Developer
> >>>
> >>> e | [EMAIL PROTECTED]
> >>
> >>
> >
> >
> 
> 
> -- 
> Have fun or die trying - but try not to actually die.
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to