Zend Navigation routes in xml config not using passed in parameters
-
08-06-2021 - |
Question
I have a route:
resources.router.routes.page.route = "page/:page"
resources.router.routes.page.defaults.module = "core"
resources.router.routes.page.defaults.controller = "page"
resources.router.routes.page.defaults.action = "view"
resources.router.routes.page.defaults.page = "home"
Here is my navigation xml:
<company>
<label>Company</label>
<route>page</route>
<page>company</page>
</company>
As you can see here, Id like to use my route (and use the page variable) within my zend navigation xml. The problem is, the page element isn't being used. The result becomes:
http://localhost/website/public/page
instead of
http://localhost/website/public/page/company
How can I get zend navigation to use the page parameter?
Thanks!
Solution
You need to wrap the page element within a params element. See as follows:
<company>
<label>Company</label>
<route>page</route>
<params>
<page>company</page>
</params>
</company>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow