1

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);
}
Charles
  • 50,943
  • 13
  • 104
  • 142
lander
  • 141
  • 1
  • 4
  • 13

2 Answers2

0

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?

allnightgrocery
  • 1,370
  • 1
  • 8
  • 15
  • I've tried that, but it does not work. Does anyone have an idea whether it is possible with an ini file? – lander Jun 02 '10 at 08:40
0

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
  • 141
  • 1
  • 4
  • 13