Specifying CSS class of a Zend_Navigation li element

delete your code, development, php, zend Comments Off on Specifying CSS class of a Zend_Navigation li element

Zend Navigation is a really nice tool to handle menus.

You just specify an array of your menu items:

$pages = array(
        'label'      => 'Privacy Statement',
        'controller' => 'terms',
        'action'     => 'privacy-statement',
        'class'      => 'firstNav',
        'label'      => 'General Terms of Use',
        'controller' => 'terms',
        'action'     => 'general-terms-of-use',

and initialize the navigation object with it — and it works:

$container = new Zend_Navigation($pages);

Result is the following:

<ul class="nav">
    <li class="active">
        <a class="firstNav" href="/terms/privacy-statement">Privacy Statement</a>
        <a href="/terms/general-terms-of-use">General Terms of Use</a>

There are options to specify the CSS class of the whole UL tag. If you specify CSS of a menu item (“firstNav” in my example), it’s added to to the A tag, not the LI tag as required by sliced design I have.

Googling shows that people are trying to work-around that by jQuery fixes.

It seems there is a proper way to solve this; you just need to add this option:



WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in