views:

55

answers:

1

There is a method isActive() in Zend_Navigation. But it returns true for all the elements in the current path (parent li is active and all the children too, even when the current is parent li).

Is there any method like isCurrent(), to determine whether the current menu item is the current page?

I just like to add custom class attribute to just one, current element in the whole nested tree of ul's and li's.

A: 

You will need to use your own navigation view script, but that's fairly simple. Then try:

$this->navigation()->findActive($this->yourNavContainer);

That will return an object, var dump it and you will see the data you need. I think the variable is simply called 'page'. Do this before you build your menu, pre/post dispatch, then in your viewscript, do an if statement to check this var against the current looped item (i guess your loop it in a foreach).

Ashley