WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Need a top-level menu item without a page
  • Print
Pages: [1]   Go Down

Author Topic: Need a top-level menu item without a page  (Read 5626 times)

Offline jbs

  • Posts: 27
    • JimBits Solutions
Need a top-level menu item without a page
« on: July 19, 2010, 08: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.releaseinternational.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

Offline pieterb

  • Posts: 46
  • Gender: Male
Re: Need a top-level menu item without a page
« Reply #1 on: July 21, 2010, 09: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

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: Need a top-level menu item without a page
« Reply #2 on: July 21, 2010, 10:57:15 AM »
Simply click 'Home' on top of this side and then explore the menu.
Logged
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"We need education to cope with digitalization - and NOT the digitalization of education.!"

Tägliches Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

snark

  • Guest
Re: Need a top-level menu item without a page
« Reply #3 on: July 21, 2010, 12:09:26 PM »
Code: [Select]
<div id="nav">
<?php show_menu2(1, SM2_ROOT, SM2_MAX+1, SM2_ALL, &#39;<li>[if( level == 0 ){<a>[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]&#39;, "</li>", &#39;<ul class="ullev[level]">&#39;, "</ul>", true, 
&#39;<ul id="header_menu" class="menu">&#39;);
 ?>
<br style="clear:left;"/>
</div>

disables the top level-link
Logged

Offline jbs

  • Posts: 27
    • JimBits Solutions
Re: Need a top-level menu item without a page
« Reply #4 on: July 28, 2010, 06: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

  • Guest
Re: Need a top-level menu item without a page
« Reply #5 on: July 29, 2010, 12:27:13 PM »
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.

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

Offline jbs

  • Posts: 27
    • JimBits Solutions
Re: Need a top-level menu item without a page
« Reply #6 on: August 06, 2010, 12:12:58 AM »
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

Offline jbs

  • Posts: 27
    • JimBits Solutions
Re: Need a top-level menu item without a page
« Reply #7 on: August 16, 2010, 11: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: [Select]

<div id="nav">

<?php show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, &#39;<li>[if( id==4 || id==6 || id==57 ){<a>[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]&#39;, "</li>", &#39;<ul class="ullev[level]">&#39;, "</ul>", true, &#39;<ul id="header_menu" class="menu">&#39;);?>

</div>



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

Code: [Select]

<div id="nav">

<?php show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, &#39;<li>[if( class==menu-expand ){<a>[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]&#39;, "</li>", &#39;<ul class="ullev[level]">&#39;, "</ul>", true, &#39;<ul id="header_menu" class="menu">&#39;);?>

</div>


I figured someone else might find use for this code sometime.
« Last Edit: August 17, 2010, 12:03:23 AM by jbs »
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Need a top-level menu item without a page
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2