Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Alexander Netkachev's Blog:
404 error with Zend Framework Front Controller
Mar 15, 2007 @ 14:39:00

Alexander Netkachev has a new post to his blog that talks about a handy method he discovered when using the Zend Framework to help replace the default "invalid controller" message the Framework gives when hitting a location there's no action for.

A few days ago I noted a quick but very usefull tip on how to handle the situation when Front Controller is unable to dispatch the request, i.e. how to display 404 error page instead of Zend_Controller_Dispatcher_Exception with message "Invalid controller specified". And it looks like the common solution for this is to create a front controller plugin. The plugin detects whether the request is dispatchable and changes module/controller/action to appropriate action that will handle the request.

His solution uses a NoRoute controller to check and see if there is a valid controller for the requested action. If not, it routes them to a custom controller with a nicer error message. For those that want a bit more low level type of solution, he also includes how to modify the framework itself to perform the same action.

tagged: zendframework 404error front controller noroute example zendframework 404error front controller noroute example

Link:

Alexander Netkachev's Blog:
404 error with Zend Framework Front Controller
Mar 15, 2007 @ 14:39:00

Alexander Netkachev has a new post to his blog that talks about a handy method he discovered when using the Zend Framework to help replace the default "invalid controller" message the Framework gives when hitting a location there's no action for.

A few days ago I noted a quick but very usefull tip on how to handle the situation when Front Controller is unable to dispatch the request, i.e. how to display 404 error page instead of Zend_Controller_Dispatcher_Exception with message "Invalid controller specified". And it looks like the common solution for this is to create a front controller plugin. The plugin detects whether the request is dispatchable and changes module/controller/action to appropriate action that will handle the request.

His solution uses a NoRoute controller to check and see if there is a valid controller for the requested action. If not, it routes them to a custom controller with a nicer error message. For those that want a bit more low level type of solution, he also includes how to modify the framework itself to perform the same action.

tagged: zendframework 404error front controller noroute example zendframework 404error front controller noroute example

Link:

Richard Lord's Blog:
Managing 404 errors in the Zend Framework
Feb 17, 2007 @ 02:23:00

In a new entry to his blog today, Richard Lord takes a look at how to gracefully handle 404 errors in a Zend Framework application (via a custom plugin).

Early versions of the Zend Framework had a noRoute action that was called when the correct action couldn't be found. This was a way to deal with some page not found errors. At some point it was dropped - I don't know when or why because I only started using the Zend Framework recently. It's still possible to handle non-existent actions using the __call() method of the controller class. But there's no obvious way to deal with all page not found errors in one place, including instances where the controller doesn't exist.

The framework makes it easy to create actions link to controllers, but there's still a problem when a requested action isn't there. His plugin has a solution to that - it is fired off when the action requested doesn't exist and automatically reroutes it to the "noroute" controller to be handled.

tagged: zendframework 404error handle action plugin zendframework 404error handle action plugin

Link:

Richard Lord's Blog:
Managing 404 errors in the Zend Framework
Feb 17, 2007 @ 02:23:00

In a new entry to his blog today, Richard Lord takes a look at how to gracefully handle 404 errors in a Zend Framework application (via a custom plugin).

Early versions of the Zend Framework had a noRoute action that was called when the correct action couldn't be found. This was a way to deal with some page not found errors. At some point it was dropped - I don't know when or why because I only started using the Zend Framework recently. It's still possible to handle non-existent actions using the __call() method of the controller class. But there's no obvious way to deal with all page not found errors in one place, including instances where the controller doesn't exist.

The framework makes it easy to create actions link to controllers, but there's still a problem when a requested action isn't there. His plugin has a solution to that - it is fired off when the action requested doesn't exist and automatically reroutes it to the "noroute" controller to be handled.

tagged: zendframework 404error handle action plugin zendframework 404error handle action plugin

Link:


Trending Topics: