Thank you for your detailed reply.
I couldn't get your second solution to work. The _script['path'] was
empty for some reason.
For now I extended the ViewRenderer and removed (Zend_Filter_Word)
CamelCaseToDash in the getInflector method[1].
It feels a bit like a hack but it works for me.
[1]http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.viewrenderer
Scroll a bit for the Default Lookup Conventions note
Kind regards,
--
S.
On 20 Aug 2008, at 20:33, Keonetworks wrote:
Hi Sen,
you have an explanation of the origin of this behaviour here :
http://framework.zend.com/manual/en/zend.controller.action.html#zend.controller.action.viewintegration.render
Indeed, camalCase seems to be detected in case 3.
You can change this behaviour with one of these tips :
- you can specify manualy at the end of each action method the view
script to render :(
- you can make your own view class by extending Zend_View_Abstract,
overriding the protected function _script() where is tried to be found
the script file (like implementing that if it's not found it tries a
second time, with the '-' removed from the file name). Don't forget to
tell the view renderer to use this view class :
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setView($myNewViewClassInstance);
- you can also find where the request is parsed to retrieve the 'action'
parameter, and add an strtower() there (not very clean...)
I think that there are better ways, so lets hope that another member
posts his solution soon...
Regards,
--
Frederik Eychenie
KEONETWORKS SARL
feychenie[at]keonetworks[dot]com
Sen Haerens wrote :
> I'm encountering some strange behaviour when simulating a typo error
> (capitalization) in an url.
> In the example I have defined an account controller with a login
> action.
>
> * case 1
> http://foo.bar/account
> http://foo.bar/accounT
>
> view render OK -> scripts/account/index.phtml
>
> * case 2
> http://foo.bar/account/login
> http://foo.bar/account/LOGIN
>
> view render OK -> scripts/account/login.phtml
>
> * case 3
> http://foo.bar/account/logiN
> http://botra.dev/account/LOGIn
>
> Fatal error: Uncaught exception 'Zend_View_Exception' with message
> 'script 'account/log-in.phtml' not found in path
>
> How to avoid case 3?
> I always want to render scripts/account/login.phtml.
>
没有评论:
发表评论