WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Need a top-level menu item without a page
Argos:
--- Quote from: jbs on July 28, 2010, 06:01:49 AM ---Snoork -- they want some of the top menu items to work and not others, so I don't want to kill them all. But I'll keep this code for other uses; definitely useful in other cases.
--- End quote ---
You can add conditions to the menu call like (in pseudo code) "if page ID=xxx, then disable link". I'm no coder so I cannot give you the right code but I have seen it on the forum sometimes. Please search for it.
jbs:
I was gone for a week without internet access, so ended up having to let this drop. But I was thinking exactly the same thing, based on Snoork's coding. I'll give it a try and post the coding here if it works.
jbs:
The coding is there in the show_menu2 documentation; it just takes some working around. Here's the coding I got to work. My client wanted only select top menu items to not be clickable (links to page ID 4,6 and 57), so I used the following (in index.php of the template):
--- Code: ---
<div id="nav">
<?php show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, '<li>[if( id==4 || id==6 || id==57 ){<a>[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]', "</li>", '<ul class="ullev[level]">', "</ul>", true, '<ul id="header_menu" class="menu">');?>
</div>
--- End code ---
To disable all top menus where there is a sub-menu you can use the following:
--- Code: ---
<div id="nav">
<?php show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, '<li>[if( class==menu-expand ){<a>[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]', "</li>", '<ul class="ullev[level]">', "</ul>", true, '<ul id="header_menu" class="menu">');?>
</div>
--- End code ---
I figured someone else might find use for this code sometime.
Navigation
[0] Message Index
[*] Previous page
Go to full version