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 Answer 1

1

(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).

Sign up to request clarification or add additional context in comments.

2 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.