0

I have all the menu items in a Zend Navigation Container. I'm displaying the breadcrumb via Zend's breadcrumb helper.

When I visit one of the menu items, it's displaying the breadcrumb correctly. However, if I have a page which doesn't occur in the Navigation Container, it doesn't show a breadcrumb, which makes sense. But I do want to show a breadcrumb on some of those pages.

I have a controller named "cart" and an action named "checkout". When I visit the page /cart/checkout, I do want to show a breadcrumb. But what's the best way of doing this? Can I manually add breadcrumblinks in de controller or do I have to add the page to the Navigation Container?

1 Answer 1

4

There are three possibilities:

  • add the required paged statically to your navigation container (through code or a configuration file)
  • add the required pages dynamically to your navigation container; either in the action method itself, in the controller-init()-method or via a front-controller-plugin
  • create a separate navigation container with just the pages required by the breadcrumb and pass this container to the breadcrumb-helper (bypassing the automatic container-recovery using the registry).
Sign up to request clarification or add additional context in comments.

3 Comments

I'd go with the first option - add an MVC type page.
Adding pages to the navigation does work, but this also adds the items to the menu. Is there a easy way to prevent these items to be displayed in the menu?
Using different navigation containers is the way to go if you don't want your main navigation to be influenced. Alternatively you can use custom properties on your pages and exclude pages with this special property from the menu-generation (requires you to use custom templates).

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.