2008年11月7日星期五

Re: [fw-mvc] Default controller = ModulenameController.php

Matthew Weier O'Phinney-3 wrote:
>
> -- webPragmatist <chris@webpragmatist.com> wrote
> (on Thursday, 06 November 2008, 09:19 AM -0800):
>> I was wondering if it would be possible to make the name of the default
>> controller be the same as the module's name.
>>
>> For instance:
>> /application/thismodule/controllers/ThisModuleController.php would be the
>> default controller for the module "thismodule."
>>
>> I have tried using setDefaultControllerName() but I can't seem to get the
>> module name using the Request object before the route is seemingly
>> finished.
>>
>> Any ideas?
>
> Do it in a routeShutdown() plugin -- at that point routing is finished,
> and you'll know what the module is.
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>

I have tried the above suggestion but it seems that using the route is
already finished (or already knows which controller to select).

$this->_front->setDefaultControllerName($request->getModuleName());

We will assume that this would completely break the application because it
is looking for "DefaultController.php" but in this case, even after setting
it in routeShutdown(), it still goes to IndexController.php
--
View this message in context: http://www.nabble.com/Default-controller-%3D-ModulenameController.php-tp20365544p20382982.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论:

发表评论