views:

35

answers:

1

In Zend's Documentation they write about creating Navigation Containers. But they don't explain where I should create them. Does anyone know that?

I'm also wondering if a custom Navigation Container extends or overwrites the navigation.xml file which contains the static links.

(I want to make a custom Navigation Container to add dynamic links from my database)

+1  A: 

(I want to make a custom Navigation Container to add dynamic links from my database)

Create a controller plugin and initialize the containers there.

If you need, you may restrict it to run only on specific module/controller/action by creating conditions on request parameters or even switch layout if needed.

You may also create navigation container as a model, or create getNavigation() in your existing model and use in anywhere, whenever you need it.

Another solution is to create the navigation container in the view helper on the fly.

Choose the one which works best in your case (eg. depending how do you handle cache).

takeshin
`Create a controller plugin and initialize the containers there.` preDispatch() I assume?
Enrico Pallazzo
@Wouter Yes, `preDispatch()` seems to be the most common one.
takeshin