views:

538

answers:

2

Hi, I can't seem to find where to specify the CSS class of the list items for rendering a Zend_Navigation object. I know you can set the class of the ul tag via the navigation menu view helper and the class of the anchor via a page attribute...but not the li tag containing the anchor.

Can anyone point me in the right direction?

+1  A: 

You can use your own view script to customize your HTML output. There is currently no direct way to change the class of the li element.

$this->navigation()->menu()->setPartial('yourpartialview.phtml');
Franz
Thanks, I actually looked into using partials, but the only problem is Zend_Navigation does not take ACL into account this way, which is something that I need.
rr
No? Does that mean the view script gets passed all the menu elements - even the forbidden ones?
Franz
That's correct, if you take a look in Zend/View/Helper/Navigation/Menu.php, I believe the ACL logic is in the _renderMenu method. When you have partials enabled, it does not perform that logic and throws all menu elements to the partial view.
rr
Hmmm... that stinks. Can you write a custom plugin? I know the `liStyle` option has been requested, but that may or may not take a while...
Franz
Would love to, but I think for time's sake, I'll just change my CSS and JavaScript.
rr
A: 

I ended up writing an extension to the Navigation Menu View Helper included with the zend framework. See my most recent post at http://www.zendcasts.com/forum/topic/97/integrating-acl-with-zendnavigation-using-view-partials-for-rendering/ if you're interested.

rr