How do you make the parent menu unclickable? <SOLVED>

Roych

#26
Quote from: Stefek 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:

<?php    
    show_menu2
(
        
0,SM2_ROOTSM2_ALLSM2_ALL
        
'[li]
        [if(level != 0 || id == 777){ 
        <a href="[url]">[menu_title]</a>
        }                     
        else{
        <a>[menu_title]</a>
        }]'

        
'</li>'
        
false
        
false
        
false
        
'<ul id="header_menu" class="menu">'
    
);         
?>


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

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

Kind regards,
Stefek



Hi

I would like to achieve this also and was wondering if it is possible to add more id's to level !=0 than just home page. Or at least all id's clickable, but one!

Thank you

R.

Stefek

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


[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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

Stefek

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:

<?php    
    show_menu2
(
        
0,SM2_ROOTSM2_ALLSM2_ALL
        
'[li]
        [if(level != 0 || id == 777){ 
        <a href="[url]">[menu_title]</a>
        }                     
        else{
        <a>[menu_title]</a>
        }]'

        
'</li>'
        
false
        
false
        
false
        
'<ul id="header_menu" class="menu">'
    
);         
?>


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

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

Kind regards,
Stefek

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Argos

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:

<ul><li><a href="http://YOURDOMAIN.COM">Home</a></li></ul>
<?php show_menu2(0,SM2_ROOT
SM2_ALLSM2_ALL
'[li][if( level == 0 ){<a>[menu_title]</a>}else{<a href="[url]">[menu_title]</a>}]'
"\n</li>"
falsefalsefalse
'<ul id="header_menu" class="menu">'
);         
?>


You may have to style the URL of the Home button to match the rest of the menu.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

tsb

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.

Stefek

Hello,
I just marked the place where you should put you attention on.

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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,

Stefek

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:

<?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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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   :-(


tsb

Is there away of making the "home" link remain clickable?

Stefek

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

Thank You so much Stefek!, the last code you posted, did exactly what I was wanting.

:-)

Stefek

Hello,
this should work:


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



Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

#12
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,

Argos

It would help if we could see the site. Can we get a URL?
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

tsb

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,

Stefek

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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,

Argos

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.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Stefek

#6
    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]
<?php 
                show_menu2
(0SM2_ROOTSM2_ALLSM2_ALL
                
'[li][if(LEVEL==0){<span>[menu_title]</span>}else{<a href="[url]"><span>[menu_title]</span></a>}]'//$aItemOpen 
                
"\n</li>"
                
false
                
false
                
false
                
'<ul id="header_menu" class="menu">'); 
                
?>



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


<?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      '[li][a][menu_title]</a>',
        
$aItemClose     '</li>',
/* the next two lines have to do with the Menu and Submenu Structure*/
        
$aMenuOpen      '[ul]',
        
$aMenuClose     '</ul>',

        
$aTopItemOpen   false,

        
$aTopMenuOpen   false
        
);
?>




    Regards and lots of fun!
    Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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,

Stefek

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

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

tsb

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,

:-)

kweitzel

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