views:

2389

answers:

3

So i've followed the tutorial Zend Framework: Navigation and Breadcrumbs with an XML File in ZF 1.8 and all is working well, but i now want to use the jdmenu jquery plugin to renderer a cleaner looking horizontal menu. By default, the Zend framework wraps the menu html code in this element name

<ul class="navigation">

I think i can call this method to set the 'ul' element class atttribute to 'jbmenu'

Zend_View_Helper_Navigation_Menu->setUIClass('jdMenu');

but i'm not sure how i can get access to the Zend_View_Helper_Navigation_Menu object reference. Should this be done in the Bootstrap.php file in the __initNav() method?. Any advise would be appreciated.

+1  A: 

jdmenu initializes like this:

$('ul.jd_menu').jdMenu();

So, you should be able to leave Zend alone and simply alter the initialization line to match the name of the UL being used. E.g.,:

$('ul.navigation').jdMenu();
joej
I couldn't get the jdMenu() javascript call to work, so i was just using jquery to add the extra class name to the zend generated div.$("ul.navigation").addClass("jd_menu");
emeraldjava
+1  A: 

If you want to specify this in Zend you access the View Helper when printing the menu in your layout. So you could use:

//layout.phtml
echo $this->navigation()->menu()->setUlClass('jdMenu');
eckberg
thanks for that - the correct css class name is 'jd_menu'.<?php echo $this->navigation()->menu()->setUlClass('jd_menu'); ?>
emeraldjava
Even with the jd_menu plugin loading, the structure of the zend generated menu html is not as i'd like, and it doesn't meet the expectation of the jd_menu library. For the moment, i'm going to park this, and just use a custom css solution in my application.
emeraldjava
A: 

Use this:

$this->navigation()->menu()->setUlClass('jd_menu')->renderMenu($container);

Sil2