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.8 is now available!


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 »
  • Menu with one step without links
  • Print
Pages: [1] 2   Go Down

Author Topic: Menu with one step without links  (Read 24187 times)

viiksi

  • Guest
Menu with one step without links
« on: October 19, 2010, 01:57:29 PM »
Hello,

Heres a little explaining.

root
-level1
-level1
---level2 (Not link)
-----level3
---level2 (Not link)
-----level3
-----level3
-level1

Heres what i have at the moment.
<?php show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_ALL, false,"\n</li>", false, false, false, '<ul id="header_menu" class="menu">'); ?>

In this i make links that starts from level1. (root level shows elsewhere)
What i want is Level2 to be only text and not linkable row but still should open Level3 onmouseover. And of course level3 should be links again ;)

Not sure if i explained this easy enough ;)

Could there be some css code that would make level2 not linking to that page.

 - viiksi
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Menu with one step without links
« Reply #1 on: October 19, 2010, 02:07:44 PM »
You can use just sm2 for this.

See documentation and the topic on conditionals
Pseudocode: [if level=n {nolink} else {link} ]

Regards,
Stefek
« Last Edit: October 19, 2010, 02:09:52 PM 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

viiksi

  • Guest
Re: Menu with one step without links
« Reply #2 on: October 19, 2010, 02:22:31 PM »
Thanks for fast answer.

I read the documentation many times allready even before this ;)
But in that document there is no {nolink} option at all.

i still dont get it where in that line to put your code.

 - viiksi

Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Menu with one step without links
« Reply #3 on: October 19, 2010, 02:43:56 PM »
it was just a "pseudo code".

Please read the opic on conditionals, as I said before:
http://code.google.com/p/showmenu2/source/browse/tags/4.9/README.en.txt#463

What you'll need is something like

...
      $aItemOpen      = '[if level=2 {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
...


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 DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: Menu with one step without links
« Reply #4 on: October 19, 2010, 03:03:03 PM »
Quote from: Stefek on October 19, 2010, 02:43:56 PM
...
      $aItemOpen      = '[if level=2 {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
...


this solution is ok. But unfortunately  hardcoded to a special level. Softcoded it can look like that:
Code: [Select]
     $aItemOpen =>>    '[if target==_self {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',

it's a bit tricky use of Target. For 'normal' pages you can use the target '_top' for 'break frameset' and '_blank' for an external link. If you choose '_self' so the menu_title is displayed without a link.

ps @stefek:: compare by  == instead of = then it works..  :wink:
« Last Edit: October 19, 2010, 03:06:30 PM by DarkViper »
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 !

viiksi

  • Guest
Re: Menu with one step without links
« Reply #5 on: October 19, 2010, 03:13:55 PM »
Quote from: Stefek on October 19, 2010, 02:43:56 PM
it was just a "pseudo code".

I really have to confess that i had to use wikipedia even to check what "pseudo code" means ;)

As you might notice now im not good at coding.

But yes now we are on right track.

I will bang my head to wall tonight to get this work.

 ps. For this solution hardcoded works very well since its never going to be changed afterwards.

 - viiksi
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Menu with one step without links
« Reply #6 on: October 19, 2010, 03:18:53 PM »
Quote from: DarkViper on October 19, 2010, 03:03:03 PM
it's a bit tricky use of Target. For 'normal' pages you can use the target '_top' for 'break frameset' and '_blank' for an external link. If you choose '_self' so the menu_title is displayed without a link.
Too confusing..
It's the same as using  Keywords for unique titles in the menu ;-)

Quote from: DarkViper on October 19, 2010, 03:03:03 PM
ps @stefek:: compare by  == instead of = then it works..  :wink:
Of course, just on the fly, no testing..

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

viiksi

  • Guest
Re: Menu with one step without links
« Reply #7 on: October 19, 2010, 11:24:29 PM »
Well thanks for you both.
I know finally understand what those false words even means on that code ;)

It was good that you didnt tell me right solution straightaway so i had to think.

I had to do some modification to the code so it started to work.

Quote from: Stefek on October 19, 2010, 02:43:56 PM
...
      $aItemOpen      = '[if level=2 {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
...


to '[if(level=2) {<...
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Menu with one step without links
« Reply #8 on: October 19, 2010, 11:37:17 PM »
Quote from: viiksi on October 19, 2010, 11:24:29 PM
It was good that you didnt tell me right solution straightaway so i had to think.

Yes great,
mostly like people using their own brains  :wink:

Glad you got it working.

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 davidwaterman

  • Posts: 9
Re: Menu with one step without links
« Reply #9 on: February 16, 2011, 10:04:28 AM »
Hi Guy's I'm trying to do the same. But get code printing to the screen. Would you tell me what i'm doing wrong please?

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

Thanks in advance.
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #10 on: February 13, 2014, 12:16:48 PM »
I just can't seem to get this working.

I'm replacing

Code: [Select]
$aItemOpen      = false,
with

Code: [Select]
$aItemOpen      = '[if level=2 {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
But does not work. Am I doing something wrong?


Thanks
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #11 on: February 13, 2014, 12:34:50 PM »
missing the () arround the question  -> if (level=2)
Code: [Select]
$aItemOpen      = '[if (level=2) {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #12 on: February 13, 2014, 01:10:48 PM »
Thanks but still does nothing at all  :?
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #13 on: February 13, 2014, 01:12:34 PM »
Is it right adding it in modules/showmenu2.includes.php ?
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #14 on: February 13, 2014, 01:24:49 PM »
Quote from: daydreamer on February 13, 2014, 01:12:34 PM
Is it right adding it in modules/showmenu2.includes.php ?
no, thats a part from the show_menu2() call in your template index.php

as eample from my actual project
this show_menu2 remove the URL and set only a #, if this menu point has subpages - [if(class==menu-expand)
and it set the class "down" for all menu points in the first level  [if(level=1){down}]


Code: [Select]
<?php show_menu2(
                        
$aMenu          = 1,
                        
$aStart         = SM2_ROOT+1,
                        
$aMaxLevel      = SM2_ALL,
                        
$aOptions       = SM2_ALL|SM2_CURRTREE|SM2_PRETTY,
                        
$aItemOpen      = '<li class="[class]"><a href="[if(class==menu-expand){#}][if(class!=menu-expand){[url]}]" class="[class] p[page_id] [if(level=1){down}]" title="[menu_title]">[menu_title]</a>',
                        
$aItemClose     = '</li>',
                        
$aMenuOpen      = '<ul>',
                        
$aMenuClose     = '</ul>',
                        
$aTopItemOpen   = false,
                        
$aTopMenuOpen   = '<ul class="nav" id="dropline">'
        
); ?>
« Last Edit: February 13, 2014, 01:29:14 PM by jacobi22 »
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #15 on: February 13, 2014, 03:23:34 PM »
I'm no coder at all, I am using this in my template index.php

Code: [Select]
<?php show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_NUMCLASS|SM2_PRETTY, false, false); ?>
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #16 on: February 13, 2014, 05:46:29 PM »
try this

shoes no Links in Level 2, only the menu_title
(remember , WB starts in LEVEL 0 (zero)

Code: [Select]
<?php show_menu2(
                        
$aMenu          = 1,
                        
$aStart         = SM2_ROOT,
                        
$aMaxLevel      = SM2_ALL,
                        
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
                        
$aItemOpen      = '<li class="[class]"><a href="[if (level=2) {<li>[menu_title]} else {<li>[a][menu_title]</a>}]'" title="[menu_title]">[menu_title]</a>',
                        
$aItemClose     = '</li>',
                        
$aMenuOpen      = '<ul>',
                        
$aMenuClose     = '</ul>',
                        
$aTopItemOpen   = false,
                        
$aTopMenuOpen   = '<ul>'
        ); ?>

if you need Level 0 or Level 1 without Links, change the Line $aItemOpen  at this point -> if (level=2)
« Last Edit: February 13, 2014, 05:48:29 PM by jacobi22 »
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #17 on: February 14, 2014, 11:38:28 AM »
Thanks but that code is throwing an error
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Menu with one step without links
« Reply #18 on: February 14, 2014, 11:59:25 AM »
I think the problem is a little typo.

Try this:
Code: [Select]
<?php show_menu2(
                        
$aMenu          = 1,
                        
$aStart         = SM2_ROOT,
                        
$aMaxLevel      = SM2_ALL,
                        
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
                        
$aItemOpen      = '<li class="[class]"><a href="[if (level=2) {<li>[menu_title]} else {<li>[a][menu_title]</a>}]" title="[menu_title]">[menu_title]</a>',
                        
$aItemClose     = '</li>',
                        
$aMenuOpen      = '<ul>',
                        
$aMenuClose     = '</ul>',
                        
$aTopItemOpen   = false,
                        
$aTopMenuOpen   = '<ul>'
        
); ?>
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #19 on: February 14, 2014, 12:29:52 PM »
Quote from: daydreamer on February 14, 2014, 11:38:28 AM
Thanks but that code is throwing an error
sorry  :oops:
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Menu with one step without links
« Reply #20 on: February 14, 2014, 01:06:13 PM »
Quote from: jacobi22 on February 14, 2014, 12:29:52 PM
Quote from: daydreamer on February 14, 2014, 11:38:28 AM
Thanks but that code is throwing an error
sorry  :oops:

Can happen to anyone ;)
There was an extra ' after {<li>[a][menu_title]</a>}]'
The code formatting of the forum pointed me to the right direction (your php closing tag was red instead of blue)

Hope with this correction daydreamer has what he/she is looking for.
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #21 on: February 14, 2014, 01:16:57 PM »
Quote from: nibz on February 14, 2014, 01:06:13 PM
The code formatting of the forum pointed me to the right direction (your php closing tag was red instead of blue)

i copy the code from my project and change it here with daydreamers code from the top - one char to much  :roll:

p.s. thanks for repairing  :-D
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #22 on: February 14, 2014, 05:14:42 PM »
Thanks guys really appreciate this.

Now showing menu like this in my template
Code: [Select]
" title="Home">Home
About
" title="About">About
Contact
" title="Contact">Contact
Why Us
" title="Why Us">Why Us

and links like this
Code: [Select]
http://localhost/%3Cli%3E%3Ca%20href=
Logged

jacobi22

  • Guest
Re: Menu with one step without links
« Reply #23 on: February 14, 2014, 05:50:45 PM »
its testet now  :oops:

Code: [Select]
<?php show_menu2(
                        
$aMenu          = 1,
                        
$aStart         = SM2_ROOT,
                        
$aMaxLevel      = SM2_ALL,
                        
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
                        
$aItemOpen      = '<li class="[class]">[if (level=2){[menu_title]}else{<a href="[url]" class="[class]" title="[menu_title]">[menu_title]</a>}]',
                        
$aItemClose     = '</li>',
                        
$aMenuOpen      = '<ul>',
                        
$aMenuClose     = '</ul>',
                        
$aTopItemOpen   = false,
                        
$aTopMenuOpen   = '<ul>'
        
); ?>

maybe you dont need the automatic css-class in the li-Tag here <li class="[class]">
feel free to cut this to a simpla <li>
« Last Edit: February 14, 2014, 05:54:22 PM by jacobi22 »
Logged

daydreamer

  • Guest
Re: Menu with one step without links
« Reply #24 on: February 14, 2014, 07:37:12 PM »
Thanks so much for your help, works exactly as I need it with

Code: [Select]
$aItemOpen      = '<li><a href="[if(class==menu-expand){#}][if(class!=menu-expand){[url]}]" class="[class] p[page_id] [if(level=1){down}]" title="[menu_title]">[menu_title]</a>',
Logged

  • Print
Pages: [1] 2   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Menu with one step without links
 

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