ZF-8023: Zend_Navigation_Page_Mvc getHref() should have option to set escape to false


I noticed that the getHref() method of Zend_Navigation_Page_Mvc uses the default URL helper to generate the link to a page. However, the first three parameters are passed to it (params array, route string, resetparams boolean), but the fourth (escape boolean) isn't. As I have a recursive page structure in which my regex route accepts a path param with for example the string '/page1/page2/page3/pageN', the default getHref() and thus the breadcrumbs escape these slashes which generates a wrong link.

I solved this by overruling the getHref() method in my own Page class, but I think it's strange that this parameter can't be passed to the default URL helper, unlike the other three.


I have also run into this issue - The router routes hand-typed urls properly, (A regex router sending for example: /pages/path1/path2/pagename to ('module'=>'pages','controller'=>'index','action'=>'index',1=>'path1/path2/pagename') - The url helper does not generate the same url in reverse - path1/path2/pagename is urlencoded, and I don't want it to be.

I would suggest that deciding whether to urlencode parameters should be able to be done by the route configuration. Something like routes.myroute.urlencoding = false or something?

I also ran into this issue. I fixxed it in my setup by patching the class "Zend_Navigation_Page_Mvc". (see attached file) I changed following lines:

89-95 209-212 403-417 438-441 474

Oh, I forgot: After this patch, I was able to configure the navigation pages like this:

... array( 'label' => 'Link 123', 'route' => 'content', 'module' => 'default' , 'controller' => 'content', 'action' => 'content', 'encodeUrl' => false, ) ...

I also ran into this issue. Ulrich's patch would match my expectations - although, I might name the option 'encode' or 'encodeParams' instead of 'encodeUrl'.

Another work-around, is to generate the url outside of Zend_Navigation using url helpers and set the uri explicitly.