# Nested breadcrumb using zend-navigation

**URL:** <https://discourse.laminas.dev/t/nested-breadcrumb-using-zend-navigation/363>\
**Category:** Components & MVC\
**Tags:** zend-mvc, zend-navigation\
**Created:** [November 9, 2017, 12:05pm UTC](https://discourse.laminas.dev/t/nested-breadcrumb-using-zend-navigation/363 "2017-11-09T12:05:09Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![erfan](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@erfan](https://discourse.laminas.dev/u/erfan)\
**Post date:** [December 6, 2017, 10:39am UTC](https://discourse.laminas.dev/t/nested-breadcrumb-using-zend-navigation/363/16 "2017-12-06T10:39:30Z")

</div>

hi, I’ve been trying for weeks to get to know with event manager mechanism, although there are lots of documentation out there, I couldn’t work with it. I read your example but there are few things I can’t handle.  
the case is I want to add a listener which reacts to MvcEvent::EVENT\_RENDER, I mean I want to get to URL and output them automatically in view template.  
this is my listener in NavigationListener.php :

```
 namespace Blog\Events;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\ListenerAggregateInterface;
use Zend\Mvc\MvcEvent;

class NavigationListener implements ListenerAggregateInterface
{
    protected $listener;
    public function attach(EventManagerInterface $events,$priority = 1){
        $shared = $events->getSharedManager();
        $shared->attach('Zend\Mvc\View\Console\DefaultRenderingStrategy',
            MvcEvent::EVENT_RENDER,[$this,'addParams']
            ,1000);
        //$this->listener[] = $events->attach(MvcEvent::EVENT_RENDER
          // ,[$this,'addParams']
            //,1000);
    }
    public function detach(EventManagerInterface $events){}
    public function addParams(MvcEvent $event){
        // Get request URI
        $uri = $event->getResult()->getUri();
        return $uri;
    }
} 

```

first of all, I know when we want to listen to a private Event we have to use shared event manager, is this particular event private?  
second of all, is it a MUST to register this listener via onBootstrap() or init() methods?  
I put this code in module.config.php of my module:

```
'service_manager' => [
    
    'invokables'=>[
        Events\NavigationListener::class => Events\NavigationListener::class,
    ]
],
'listeners'=> [
    Events\NavigationListener::class,
],

```

how should I know what are MvcEvent::EVENT\_RENDER parameters? what is the target of this event that is to set as Identifires(I used ‘Zend\Mvc\View\Console\DefaultRenderingStrategy’)?  
how to get the return value in the listener method at the end?

---

_[View the full topic](https://discourse.laminas.dev/t/nested-breadcrumb-using-zend-navigation/363)._
