Edit
It doesn't really make sense to duplicate the 'pages' configuration as you can instruct the view helper to render what you need. So you can use the same navigation container to render different menus (e.g. breadcrumb vs main navigation).
You can do this by either using the provided breadcrumb methods such as setMaxDepth()
or setMinDepth()
. Alternatively, for more flexibility, use a view partial as I explained bellow.
In each case you are simply filtering down the complete container into the seletion you want to render.
You can use a view partial to render the breadcrumbs.
This method will find the deepest active page and pass an array of pages that leads to the active page to the partial view script.
The example in the attached link uses array_map
to render the contents of $this->pages
, however you can achieve the same result with a loop.
foreach($this->pages as $page) {
printf('<a href="%s">%s</a>', $page->getHref(), $page->getLabel());
}
Keep in mind however you will now need to check the accessibility of the page manually for the current user if you are using the ACL - This can be done using the methods available for MVC or URL pages