rr.
rr.

Reputation: 6644

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 the 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?

Upvotes: 1

Views: 4332

Answers (5)

Lukasz Kujawa
Lukasz Kujawa

Reputation: 3096

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

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

Upvotes: 2

Amjad Muhammad
Amjad Muhammad

Reputation: 1

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");

Upvotes: -1

Hugh Templeton
Hugh Templeton

Reputation: 21

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;
}

Upvotes: 2

rr.
rr.

Reputation: 6644

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.

Upvotes: 0

Franz
Franz

Reputation: 11553

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');

Upvotes: 3

Related Questions