Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 07:47:52 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155534 Posts in 21713 Topics by 7737 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Need a top-level menu item without a page  (Read 670 times)
jbs

Offline Offline

Posts: 24


WWW
« on: July 19, 2010, 07:57:06 PM »

I'm using a template with a drop-down menu. We would like a couple of the top-level menu items to be basically disabled so they don't go anywhere, but be able to show the second-level items in the drop-down. On standard links, we can use "#" but I can't find any way to make the equivalent concept work on a menu item. Anyone else tried doing this? Any ideas?

To show what I mean, the website is www.releaseinternat ional.org. They want the "Find Out More" and "Take Action" links at the top to not go to a page, but simply display the menu items under it.
Logged
pieterb

Offline Offline

Posts: 46



« Reply #1 on: July 21, 2010, 08:40:02 AM »

Hi jbs,

You can create a menu link in stead of an actual page with wysiwyg. You can link this menu link to the first page of the submenu. So the "Find Out More" and "Take Action" items remain links, but go directly to the first subpage.
Logged
DarkViper
Development Team
*****
Offline Offline

Posts: 1252


« Reply #2 on: July 21, 2010, 09:57:15 AM »

Simply click 'Home' on top of this side and then explore the menu.
Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
snark
Guest
« Reply #3 on: July 21, 2010, 11:09:26 AM »

Code:
<div id="nav">
<?php show_menu2(1SM2_ROOTSM2_MAX+1SM2_ALL'<li>[if( level == 0 ){<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">');
 ?>
<br style="clear:left;"/>
</div>

disables the top level-link
Logged
jbs

Offline Offline

Posts: 24


WWW
« Reply #4 on: July 28, 2010, 05:01:49 AM »

pieterb -- I was thinking of that and may end up doing that. But they would prefer if it just stayed where it is (similar to a "#" link would do on a hyperlink). If I can't find what they are looking for, I may do it that way.

DarkViper -- sorry, not following

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.
Logged
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #5 on: July 29, 2010, 11:27:13 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.

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.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
jbs

Offline Offline

Posts: 24


WWW
« Reply #6 on: August 05, 2010, 11:12:58 PM »

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.
Logged
jbs

Offline Offline

Posts: 24


WWW
« Reply #7 on: August 16, 2010, 10:59:56 PM »

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(0SM2_ROOTSM2_ALLSM2_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>



To disable all top menus where there is a sub-menu you can use the following:

Code:

<div id="nav">

<?php show_menu2(0SM2_ROOTSM2_ALLSM2_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>


I figured someone else might find use for this code sometime.
« Last Edit: August 16, 2010, 11:03:23 PM by jbs » Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!