2009年11月27日星期五

Re: [fw-mvc] Zend_Navigation & custom routes = several problems

Marcus,

I ran into this problem as well this past week. What I did to fix it was put <route>default</route> on everyone that is using the default.  What I found is that when you are on a page that uses a route it forces the route to be that route for every link that doesn't have a route specified.  I see this as being a flaw with Zend_Navigation.  I have yet to find the actually code that causes the bug but when I do I'll submit a ticket with a patch in the Issue Tracker.

Hope this helps,

--
Zend Certified EngineerJon Whitcraft
Zend Certified Engineer
jwhitcraft@mac.com



Marcus Stöhr wrote:
Hi list,  to create my navigation I use the following bootstrap-code:  $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav'); $nav = new Zend_Application_Resource_Navigation(array('pages' => $config));  Contents of navigation.xml:  <?xml version="1.0" encoding="UTF-8"?> <configdata> 	<nav> 		<index> 			<label>nav_index</label> 			<controller>index</controller> 			<action>index</action> 		</index> 		<release> 			<label>nav_release</label> 			<controller>title</controller> 			<action>list</action> 			<route>titlelist</route> 			<params> 				<char>0-9</char> 				<page>1</page> 			</params> 		</release> 		<names> 			<label>nav_names</label> 			<controller>names</controller> 			<action>list</action> 			<route>nameslist</route> 			<params> 				<char>A</char> 				<page>1</page> 			</params> 		</names> 		<label> 			<label>nav_label</label> 			<controller>sites</controller> 			<action>list</action> 			<route>labellist</route> 			<params> 				<char>0-9</char> 				<page>1</page> 			</params> 		</label> 		<search> 			<label>nav_search</label> 			<controller>search</controller> 		</search> 		<help> 			<label>nav_help</label> 			<controller>help</controller> 		</help> 		<forum> 			<label>nav_forum</label> 			<uri>http://www.soundtrack-board.de</uri> 		</forum> 	</nav> </configdata>  This works and the navigation gets created, BUT when I hover the links which uses no named route, the links isn't just the expected controller/action-couple but the actual route used for the page I'm on, e.g.  /public/names/0-9-p1.html but it should show /public/search  My custom routes are utilizing Zend_Controller_Router_Route_Regex.  The other problem is: There is no active link and so I can't use some of the helper methods to enhance my navigation with a sub-navigation.  What do I wrong?  - Marcus    

没有评论: