Hi Gonyuu
Work on the new MVC is commencing so all current issues will probably
be delayed in being resolved/examined for a short while. However the
problem you describe isn't necessarily an 'issue', more an approach.
If it helps you, my approach is to make an abstract Action controller
for each of my projects (e.g. class Myproject_Action_Controller
extends Zend_Controller_Action) and to then put the 'norouteAction'
method in that. It makes more sense for me to do that as I can then
gracefully catch errors and display them on a per-site basis to avoid
a more 'templated' approach. It's also a good idea to create a
wrapper such as this to envelop any application-specific logic such
as authentication.
Cheers
Hello all,
Has this issue been resolved? The solution proposed here sounds
perfect, and
the fix seems quite easy. When might it be implemented? I don't see
it as of
the latest developer release.
Associated Issue/Bug Link: http://framework.zend.com/issues/browse/
ZF-310
Thanks, gonyuu
Chad Minick wrote:
Hello, I have been lurking on this mailing list for quite awhile,
trying
to find my niche where I feel comfortable to contribute, but I
thought I
at least try to develop an application with ZF before I put in my 2
cents. I started to develop my blog with ZF 0.1.5.
I started out with my index.php and in it I have the following
controller and routers set up.
//Router
$router = new Zend_Controller_RewriteRouter();
//add Routes here
$router->addRoute('admin','admin/:action/:id',array('id' =>
null,'controller' => 'admin', 'action' => 'index'));
//pass it to the controller
$ctrl = Zend_Controller_Front::getInstance();
$ctrl->setRouter($router);
$ctrl->setControllerDirectory('./private/c');
I set up my IndexController, with an indexAction and a noRouteAction.
I also set up an AdminController, with an indexAction, and thought
that
a noRouteAction would be appropriate there too.
Everything is working great except when I pass a nonesense route
to the
admin controller, I get the exception thrown by __call() in
Zend/Controller/Action.php. (blahblahAction() does not exist). It
only
took a few minutes to realize that I could over ride __call() in
AdminController to acheive the same results as IndexController's
noRouteAction. Everything works like I think it should now.
So my question is two fold:
1. Am I doing something wrong?
2. If I am not doing something wrong, would it be more intuitive
to give
every Controller a noRouteAction that could possibly redirect to a
known
route or possibly throw a 404? I first added it because I thought if
that's how IndexController works, that's how they all should work.
Thanks in advance for any feedback.
Chad Minick
--
View this message in context: http://www.nabble.com/Controller-
noRouteAction%28%29-tf2006115.html#a6700911
Sent from the Zend Framework mailing list archive at Nabble.com.
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com