Search code examples
zend-frameworkzend-navigation

How to limit the depth of Zend_Navigation?


I am creating a categories sidebar using Zend_Navigation. In my bootstrap I am putting in all my pages, products, categories and anything else I can find in the future. I am getting my categories links out using $navigation->findAllBy('class', 'categories') which is returning an array of all my categories. This is working and displaying as it should.

Now...

How do I limit the depth of the sub-categories / pages? So that instead of (at the moment) 6 levels of categories and sub-categories, I have (for example) 2?


Solution

  • $this->navigation()->menu()->setMaxDepth(2)