开发者

Specifying CSS class of a Zend_Navigation li element

I can't seem to find where to specify the CSS class of the list items for rendering a Zend_Navigation object. I know you can set the class of th开发者_C百科e ul tag via the navigation menu view helper and the class of the anchor via a page attribute...but not the li tag containing the anchor.

Can anyone point me in the right direction?


You can use your own view script to customize your HTML output. There is currently no direct way to change the class of the li element.

$this->navigation()->menu()->setPartial('yourpartialview.phtml');


Get the id name of menu, in this case #tabcontainer then use #tabcontainer li to modify

    #tabContaier_main ul{
    overflow:hidden;
    border-right:1px solid #fff;
    height:35px;
    position:absolute;
    z-index:100;
}
#tabContaier_main li{
    float:left;
    list-style:none;
}


Few years late but add a 'class' option to a navigation page and set addPageClassToLi

echo $this->navigation()->menu()->addPageClassToLi(true);


I ended up writing an extension to the Navigation Menu View Helper included with the zend framework. See my most recent post at http://www.zendcasts.com/forum/topic/97/integrating-acl-with-zendnavigation-using-view-partials-for-rendering/ if you're interested.


I had to use jQuery to set the class for the links <a> and list <li> elements. But it worked fine for me.

$('#nav-container > ul > li > a').attr("class","ui-state-default ui-corner-bottom");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜