Search code examples
zend-frameworkzend-navigation

Zend_Navigation overwrite with array?


I currently use zend_navigation via an XML file.

However I need to overwrite the previous breadcrumb to be its dynamic parent, in the controller.

Is this possible? It seems to me that zend_navigation is fairly static and the zend documentation keeps timing out.

Thanks


I have put:

    public function addAction() {

        $this->view->navigation()->addPage(array(
            'type' => 'uri',
            'label' => 'New page')
        );

in my controller but no crumbbar shows up for that page.

Any ideas? $this->navigation() threw a

Method "navigation" does not exist and was not trapped in __call() 

Also of note that my crumbBar is in my layout and not individual views.


Solution

  • Yes you can use an array.

    What you should do really is create your array and then input it into the factory of the Zend_Navigation to create your pages for you.

    Unfortunately my code is too complicated to show an example of how I used it. But I'll provide a simple example...

    Once you create your navigation container, you can just add new pages to it.

    Like

    $this->navigation()->addPage(array(
       'type' => 'uri',
       'label' => 'New page'));
    

    But you can also use addPages(). This is what I do.

    I think you should just wait for the documentation to load back up for you and then look at that. Its really easy in fact.

    When you have a more specific question, just ask that and give me a poke. I've had to use Navigation quite a lot so know it quite well.

    Additionally, check out #zftalk on freenode. Theres lots of help on there.