Question

i am having problem using Zend_Navigation here is my navigation.xml file

<?xml version="1.0" encoding="UTF-8"?>
<configdata>
    <admin>
        <dashboard>
            <label>Dashboard</label>
            <module>admin</module>
            <controller>dashboard</controller>
            <action>index</action>
        </dashboard>
    </admin>
</configdata>

here is my bootsrapping method.

public function _initNavigation()
{
    $this->bootstrap('layout');
    $layout = $this->getResource('layout');
    $view = $layout->getView();
    $config = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml', 'admin');
    $navigation = new Zend_Navigation($config);
    $view->navigation($navigation);
}

and my admin layout admin.phtml contains

<?php echo $this->navigation()->menu(); ?>

the problem is the navigation menu dashboard changes accordingly with the current module/controller/action

for instance.

if:
current page: admin/dashboard/index
generates `<a href="/admin/dashboard">Dashboard</a>`

if:
current page: admin/item/index
generates `<a href="/admin/item">Dashboard</a>`

whereas for second i expect the url not to change. the second method should generate

current page: admin/item/index
generates `<a href="/admin/dashboard">Dashboard</a>`

what is happening?

Was it helpful?

Solution

Do you have multiple routes defined? if so, add a <route> key to your <dashboard> section of the navigation.xml file that has the correct route name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top