Forum for discussing general topics related to Couch.
28 posts Page 3 of 3
Hi
Sorry for the repeat, but please let me know if its possible to attach a custom class to the top level li's
<div class="grid_4 alpha">
<ul class="mainnav">
<li><a class="hom" href="index.html"><span>Home</span></a></li>
<li><a class="abt" href="about.html"><span>About Us</span></a></li>
<li><a class="srv" href="services.html"><span>Services</span></a>
<ul>
<li><a href="#">sub1</a></li>
<li><a href="#">sub2</a></li>
<li><a href="#">sub3</a></li>
<li><a href="#">sub4</a></li>
</ul>
</li>
</ul>
</div>

<div class="grid_4">
<div id="title">
<a href="#"><h1>Site Title</h1></a>
</div>
</div>

<div class="grid_4 omega">
<ul class="mainnav">
<li><a class="gal" href="gallery.html"><span>Gallery</span></a>
<ul>
<li><a href="#">sub1</a></li>
<li><a href="#">sub2</a></li>
</ul>
</li>
<li><a class="wrk" href="work.html"><span>Work</span></a></li>
<li><a class="int" href="interests.html"><span>Interests</span></a>
<ul>
<li><a href="#">sub1</a></li>
<li><a href="#">sub2</a></li>
</ul>
</li>
</ul>
</div>

Thanks a lot.
Hi,

Apologies for the delay.

Here is the code that should output the exact code you pasted -
Code: Select all
<cms:nested_pages masterpage='menu.php' extended_info='1' childof='nav1' >
    <cms:if k_level_start >
        <cms:if k_level='0'>
            <ul class="mainnav">
        <cms:else />
            <ul>
        </cms:if>
    </cms:if>
   
    <cms:if k_element_start >
        <cms:if k_level='0'>
            <li><a class="<cms:show k_nestedpage_name />" href="<cms:show k_menu_link />"><span><cms:show k_menu_title /></span></a>
        <cms:else />
            <li><a href="<cms:show k_menu_link />"><cms:show k_menu_title /></a>
        </cms:if>
    </cms:if>

    <cms:if k_element_end ></li></cms:if>
    <cms:if k_level_end ></ul></cms:if>
</cms:nested_pages>

The code above is for the first menu. For the second menu, duplicate it and change the 'childof' parameter to 'nav2'

Please notice that the 'class' of top-level LI's <a> is the 'name' of the page so you can control that by setting the required name from admin-panel.

Hope this helps. Do let us know.
Thanks.
Worked perfectly!
Thanks a million, KK!
:oops: Please let me know how to make a list item (link) not point to any particular page.. ie, nothing happens when it is clicked (this is for top level li's which have children)
I tried with # as in html pages but it took me to the homepage.
Thanks a lot in advance.
Maybe using href="javascript:void(0)" would help?
Thanks, KK, but I have to specify that in menu masterpage -menu.php
(in the' points to another page' box) Not sure how to :?
Thanks again.
Leave the 'points to' box in admin-panel empty.
Now while generating the menu markup with our code, instead of the following
Code: Select all
href="<cms:show k_menu_link />"
use
Code: Select all
href="<cms:if k_menu_link ><cms:show k_menu_link /><cms:else />javascript:void(0)</cms:if>"

As you can see, the new code simply checks if the link is empty. If it is, it generates 'javascript:void(0)'.

Does this help?
It worked.
Leaving the 'points to' box in admin-panel empty itself works.
But I used the javascript:void(0); code.
Thanks a lot.
28 posts Page 3 of 3
cron