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 »
  • How do you make the parent menu unclickable? <SOLVED>
  • Print
Pages: [1] 2   Go Down

Author Topic: How do you make the parent menu unclickable? <SOLVED>  (Read 32168 times)

Offline tsb

  • Posts: 42
How do you make the parent menu unclickable? <SOLVED>
« on: January 16, 2010, 05:53:14 PM »
I got asked this today and tried to figure it out, I found some php coding in drupal, via this, http://drupal.org/node/128618 and theres some code in Joomla.

How do you get it to work in WebsiteBaker?,

Basically, I want the drop down menu that happens in the template allcss2, yet the top, parent is not a clickable link and is basically disabled, if anyone knows could you post,

thanks forum,

 :-D
« Last Edit: January 19, 2010, 11:25:46 PM by tsb »
Logged

Offline kweitzel

  • WebsiteBaker Org e.V.
  • **
  • Posts: 6983
  • Gender: Male
Re: How do you make the parent menu unclickable?
« Reply #1 on: January 16, 2010, 06:06:59 PM »
Placeholder Menu items are not a feature within the WB Menu Functions. Short of hardcoding the menu items into the template there is only two things you could try:

1) Use a menu call for every branch in your menu tree
2) Accept the fact that there is no placeholder and work around it by using a menu link item which links to the first subitem in the branch.

cheers

Klaus
Logged

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #2 on: January 16, 2010, 07:44:57 PM »
I kind of found a method in website baker 2.8, yet maybe not ideal.

I basically made a parent page, type as a menu link, then put in the menu link,

link:  external link > then I put in the websites home page.

This allows you to still have a drop down menu with the links but having the parent as a link to main-site and not opening up a new page, which I wanted to happen.

kinda, thanks,

 :-)
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable?
« Reply #3 on: January 16, 2010, 08:28:03 PM »
Quote from: kweitzel on January 16, 2010, 06:06:59 PM
Placeholder Menu items are not a feature within the WB Menu Functions.
That's wrong.
The show_menu2() function and its CONDITIONAL FORMATTING options is a good and working option.

Stefek

Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #4 on: January 16, 2010, 09:22:46 PM »
Do you know how the showmenu can make it so that the parent isnt a link?
I still want the childroot, drop down menu attached to them to work though

This is the code I have on the website,

        <div id="nav" class="clearfix">
            <?php show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, "\n</li>", false, false, false, '<ul id="header_menu" class="menu">'); ?><br />
        </div><!-- end nav -->

thanks,
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable?
« Reply #5 on: January 16, 2010, 10:47:40 PM »
    Does your menu work this way at all?  :-D

    OK, here is a link for study for you.

http://code.jellycan.com/files/show_menu2-README.txt


And here is the code for the $aItemOpen parameter:

'[ li][if(level==0){<span>[menu_title]</span>}else{<a href="[url]"><span>[menu_title]</span></a>}]'

all together your show_menu2 parameter call should look like this:

[/list]
Code: [Select]
<?php 
                show_menu2
(0, SM2_ROOT, SM2_ALL, SM2_ALL, 
                &
#39;[li][if(LEVEL==0){<span>[menu_title]</span>}else{<a href="[url]"><span>[menu_title]</span></a>}]&#39;, //$aItemOpen 
                
"\n</li>", 
                
false, 
                
false, 
                
false, 
                &
#39;<ul id="header_menu" class="menu">&#39;); 
                
?>


Also look at this example on the linked page (above link):

Code: [Select]
<?php
show_menu2
(
        
$aMenu          = 0,
        
$aStart         = SM2_ROOT,
        
$aMaxLevel      = SM2_CURR+1,
        
$aOptions       = SM2_TRIM,
/* the next two lines have to do with the LINKS */
        
$aItemOpen      = &#39;[li][a][menu_title]</a>&#39;,
        
$aItemClose     = &#39;</li>&#39;,
/* the next two lines have to do with the Menu and Submenu Structure*/
        
$aMenuOpen      = &#39;[ul]&#39;,
        
$aMenuClose     = &#39;</ul>&#39;,

        
$aTopItemOpen   = false,

        
$aTopMenuOpen   = false
        
);
?>



    Regards and lots of fun!
    Stefek
« Last Edit: January 17, 2010, 12:58:34 AM by Stefek »
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Argos

  • Guest
Re: How do you make the parent menu unclickable?
« Reply #6 on: January 17, 2010, 12:31:15 AM »
Quote from: tsb on January 16, 2010, 07:44:57 PM
I basically made a parent page, type as a menu link, then put in the menu link,

link:  external link > then I put in the websites home page.

This allows you to still have a drop down menu with the links but having the parent as a link to main-site and not opening up a new page, which I wanted to happen.

That's unlogical and not user friendly. Clicking on a parent menu item brings you back to the homepage? That will feel like a bug to users. You should link to the first child page, or use stefeks info above.
Logged

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #7 on: January 17, 2010, 09:30:18 PM »
I had a go with the showmenus item open, yet Im using the css2 dropdown menu, and it doesnt seem to bring that element in when I put it into the templates index.php

Im not a very logical person  :-) more used to the creative side of things, so struggling to find the method with css and the functions in showmenu. I might link to the first child page that you mentioned.

Thanks for all the feedback and possibilities,

cheers,
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable?
« Reply #8 on: January 17, 2010, 11:18:16 PM »
Quote from: tsb on January 17, 2010, 09:30:18 PM
it doesnt seem to bring that element in when I put it into the templates index.php
:-)

Oh yes, the CSS is another side if the menu.
But did you try the code? And was your Items unclickable then?

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #9 on: January 18, 2010, 09:01:16 PM »
sorry Stefan, I couldn't get it to work in my index.php file.

The menu in allcss2 template just breaks the dropdown menu, when I tried out both of the codes.

Im just not up on the coding side. cheers,
Logged

Argos

  • Guest
Re: How do you make the parent menu unclickable?
« Reply #10 on: January 18, 2010, 09:29:08 PM »
It would help if we could see the site. Can we get a URL?
Logged

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #11 on: January 18, 2010, 11:45:13 PM »
Im building the website in website baker portable, so havent got it online yet. I could send you the template Ive put together, which is based on the allcss2 template.

I will upload the zip file and post it up here, this is the unfinished template currently,

heres the link,*removed*

I hope this helps, cheers from everyone that has replied to this currently, its great to get some feedback on this,
« Last Edit: January 19, 2010, 11:25:14 PM by tsb »
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable?
« Reply #12 on: January 19, 2010, 03:16:44 AM »
Hello,
this should work:

Code: [Select]
<?php     show_menu2(0,SM2_ROOT, 
                    
SM2_ALL, 
                    
SM2_ALL, 
                    &
#39;[li][if( level == 0 ){<a>[menu_title]</a>}else{<a href="[url]">[menu_title]</a>}]&#39;, 
                    
"\n</li>", 
                    
false, 
                    
false, 
                    
false, 
                    &
#39;<ul id="header_menu" class="menu">&#39;
                
);         
            
?>


Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable?
« Reply #13 on: January 19, 2010, 06:34:57 PM »
Thank You so much Stefek!, the last code you posted, did exactly what I was wanting.

 :-)
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable?
« Reply #14 on: January 19, 2010, 06:56:42 PM »
You're welcome.

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #15 on: May 24, 2010, 07:48:16 PM »
Is there away of making the "home" link remain clickable?
Logged

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #16 on: May 24, 2010, 11:32:16 PM »
I dont really have knowledge of php, does it use if and else?

                    '
  • [if( level == 0 ){<a>[menu_title]</a>}else{<a href="[url]">[menu_title]</a>}]',
                        "\n</li>",

    this works perfectly from stefek,

    could I put a then in and name the page called home so that it remains clickable to the front page,

                        '
    • [if( level == 0 ){<a>home</a>} then {<a href="[url]">[menu_title]</a>}]',
                          "\n</li>",

      just not logical enough   :-(

Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #17 on: May 25, 2010, 12:47:10 AM »
Hello,

php (as many other scriptng languages) uses if/else, of course.
But there is no "then" in PHP.

But you may use another /if/ in your menu call using the PageID.
See the Documentation of SM2 for details (you'll find inside the sm2 package/ZIP).

It would look like:
Code: [Select]
<?php




[li][if(level == 0){<a>[menu_title]</a>} if(page_id == 777){<a>XXXX[menu_title]XXXX</a>}else{<a href="[url]">[menu_title]</a>}]

replace 777 with your pageID.
replace XXXX with what ever fits your ideas.
Should work (no time to test).

Regards,
Stefek
« Last Edit: May 25, 2010, 12:50:08 AM by Stefek »
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #18 on: May 25, 2010, 05:24:37 PM »
hey stefek, whats the xxxx for?do i put a web address in our is it the page name?

gonna try it out on the portable, cheers,
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #19 on: May 25, 2010, 05:38:44 PM »
Hello,
I just marked the place where you should put you attention on.

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #20 on: May 25, 2010, 08:49:13 PM »
Stefek, just getting errors, if I can get this to work, I definitely will put some money towards your way.
I think if I can get the home page to work still then that would be brilliant.

 I could maybe go round the long way and make a link in html, hidding the home page on the menu.
just dont understand how to put the code in to get it to work, sorry.
Logged

Argos

  • Guest
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #21 on: May 25, 2010, 09:45:49 PM »
An alternative is to leave the homepage out of the menu by making it hidden (Page Settings > Visibility > Hidden). Then add a manual home link to the menu, like so:

Code: [Select]
<ul><li><a href="http://YOURDOMAIN.COM">Home</a></li></ul>
<?php show_menu2(0,SM2_ROOT, 
SM2_ALL, SM2_ALL, 
&
#39;[li][if( level == 0 ){<a>[menu_title]</a>}else{<a href="[url]">[menu_title]</a>}]&#39;, 
"\n</li>", 
false, false, false, 
&
#39;<ul id="header_menu" class="menu">&#39;
);         
?>

You may have to style the URL of the Home button to match the rest of the menu.
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #22 on: May 25, 2010, 10:39:33 PM »
Quote from: tsb on May 25, 2010, 08:49:13 PM
Stefek, just getting errors, if I can get this to work, I definitely will put some money towards your way.

Hello,
if you really want to spent some bucks, then I always love to get PHP Books in exchange for my time ;-)
Amazon makes it possible.

But first, let's try to get the menu to work.

The following code should work properly:
Code: [Select]
<?php    
    show_menu2
(
        
0,SM2_ROOT, SM2_ALL, SM2_ALL, 
        &
#39;[li]
        
[if(level != 0 || id == 777){ 
        <
a href="[url]">[menu_title]</a>
        }                     

        else{
        <
a>[menu_title]</a>
        }]&
#39;, 
        
&#39;</li>&#39;, 
        
false, 
        
false, 
        
false, 
        &
#39;<ul id="header_menu" class="menu">&#39;
    
);         
?>

Please try it, and let me know how it works.

You will need to replace 777 by the pageID of 'home'.

Kind regards,
Stefek

Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline tsb

  • Posts: 42
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #23 on: May 25, 2010, 11:27:54 PM »
that works a treat,
just give me a php book title :) and your address via message.
get it posted by the end of the week hopefully (I hope it aint too pricey mind),
very much appreciate everyones help in the coding part 8-)

thanks again
« Last Edit: May 25, 2010, 11:30:01 PM by tsb »
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How do you make the parent menu unclickable? <SOLVED>
« Reply #24 on: May 26, 2010, 12:33:16 AM »
Quote from: tsb on May 25, 2010, 11:27:54 PM
that works a treat,
just give me a php book title :) and your address via message.
get it posted by the end of the week hopefully (I hope it aint too pricey mind),

Hello TSB,
thanks for being willing to give something for something.
Give & Take is a essential foundation of any community.

I found something not too pricey.
You got PM.

Kind regards,
Stefek


Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

  • Print
Pages: [1] 2   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • How do you make the parent menu unclickable? <SOLVED>
 

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