1

I have menu like this:

item1
 - item1.1
    - item 1.1.1
    - item 1.1.2
    - item 1.1.3
 - item1.2
    - item 1.2.1
    - item 1.2.2
item2
 - item2.1
 - item2.2

I set `setOnlyActiveBranch(true); And if I choose item.1.1.1 or item.1.1 I get this one:

item1
 - item1.1
    - item 1.1.1
    - item 1.1.2
    - item 1.1.3

At the same time if I press item1 I got this one:

item1
 - item1.1
 - item1.2

I don't want to hide other root nodes if the current node is active. So how to show menu this way (in case I choose item1.1. for example)?:

item1
 - item1.1
    - item 1.1.1
    - item 1.1.2
    - item 1.1.3
 - item1.2
item2

Is it possible to to it via standart methods or should I create new helper?

Anthony
  • 3,218
  • 3
  • 43
  • 73

2 Answers2

0

{get|set}RenderParents() gets/sets a flag specifying whether parents should be rendered when only rendering active branch of a container. If set to FALSE, only the deepest active menu will be rendered.

http://framework.zend.com/manual/en/zend.view.helpers.html

SMka
  • 3,021
  • 18
  • 14
  • It is not way that I try to solve. OK. We set renderParents to false and press item.1.1. Now we don't see item1 and item2. Its not correct. If I set setOnlyActiveBrand to false, then I see whole tree - this is not correct also. – Anthony Jun 15 '11 at 08:58
  • only way is custom viewscript via {get|set}Partial() i guess. – SMka Jun 15 '11 at 11:18
0

This is not possible with the standard methods of the navigation view helper, which is unfortunate, because it is a common case.

However there are some case issues that the ZF developers should have in mind, probably that is why it is not implemented. Such case is if you want to show non-active branches to the second level.

Item 1 - active
  Item 1.1 - active
    Item 1.1.1 - active
    Item 1.1.2
  Item 1.2
Item 2
  Item 2.1
  Item 2.2

You may also wish to have other case, show only main items, and only the active branch.

Item 1 - active
  Item 1.1 - active
    Item 1.1.1 - active
    Item 1.1.2
Item 2

I had that solved with rendering the whole menu and hiding the non-active branches with CSS.

But you may wish to limit your markup so you have to make your custom renderer.

venimus
  • 5,907
  • 2
  • 28
  • 38