I have a simple navigation setup in xml, that looks like this:
<nav>
<page1>
<controller>foo</controller>
<route>default</route>
<pages>
<p1sub1>
<controller>foo</controller>
<action>bar</action>
<route>foobar</route>
<params>
<bar>specialId</bar>
</params>
</p1sub1>
<p1sub2>
<controller>foo</controller>
<action>bum</action>
</p1sub2>
</pages>
</page1>
<page2>
<controller>fee</controller>
<route>default</route>
<pages>
<p2sub1>
<controller>fee</controller>
<action>zip</action>
</p2sub1>
<p2sub2>
<controller>fee</controller>
<action>zap</action>
</p2sub2>
</pages>
</page2>
</nav>
Coupled with a route definition that looks like this:
routes.foobar.route = "foo/:specialId/bar"
routes.foobar.defaults.controller = foo
routes.foobar.defaults.action = bar
routes.foobar.defaults.specialId = 999
In my bootstrap, I'm assigning this navigation config to the view thusly:
$config = new Zend_Config_Xml('path/to/nav.xml', 'nav');
$navigation = new Zend_Navigation($config);
$this->getResource('layoutview')->navigation($navigation);
Then, in my layout, I'm doing this to render the top level:
<?= $this->navigation()->menu()->setMaxDepth(0) ?>
The next level of menu needs to be rendered in the view script for the invoked controller action, thusly:
<?= $this->navigation()->menu()->setOnlyActiveBranch(true)->setRenderParents(false) ?>
If I visit /foo/bum, /fee/zip, or /fee/zap it all works as expected. I get two correctly rendered menus, with the corrent menu items highlighted. Marvellous. However... When I visit /foo/123/bar, I get no menus at all. I've spent HOURS looking at this now, debugging/single-stepping through the inheritance nightmare that is Zend navigation and its associated menu rendering, but I simply cannot see why it's doing this. I can't see the wood for the trees anymore. Any pointers would be greatly appreciated.