Zend Navigation add extra id
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 = $layou开发者_开发问答t->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);
}
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?
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>
精彩评论