views:

264

answers:

2

I made a menu with zend_navigation, using an ini file. That work well. If I look at the code, i see that zend has added a class, to the ul element.

With a name that i use in my ini file. But now I want to add also a id to the ul element. How can I do this?

protected function _initNavigation()
{
    $this->bootstrap('layout');
    $layout = $this->getResource('layout');
    $view   = $layout->getView();

    $iniOptions = array('allowModifications' => true);
    $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/navigation.ini', 'nav', $iniOptions);
    $config->id = 1;        

    $navigation = new Zend_Navigation($config->navigation);        
    $view->navigation($navigation);
}
A: 

I use Zend_Navigation as well but define mine in XML. I was able to add an foo node next to my label, module, controller, and route. The result was the addition of an "id" attribute and the value being "menu-foo".

Can you add the "id to your navigation.ini directly?

Inkspeak
I've tried that, but it does not work.Does anyone have an idea whether it is possible with an ini file?
lander
A: 

i can do this: Then i have an id on the li element, but not on the ul element.

[nav]
navigation.home.id = 1
navigation.home.label = Home
navigation.home.controller = index
navigation.home.action = indexter code here`

output:

<ul class="navigation">
    <li>

        <a id="menu-1" href="/">Home</a>
    </li>
</ul>
lander