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
You can use just sm2 for this.
See documentation and the topic on conditionals
Pseudocode: [if level=n {nolink} else {link} ]
Regards,
Stefek
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
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
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:
$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:
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
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
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) {<...
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
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.
I just can't seem to get this working.
I'm replacing
$aItemOpen = false,
with
$aItemOpen = '[if level=2 {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
But does not work. Am I doing something wrong?
Thanks
missing the () arround the question -> if (level=2)
$aItemOpen = '[if (level=2) {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',
Thanks but still does nothing at all :?
Is it right adding it in modules/showmenu2.includes.php ?
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}]
<?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">'
); ?>
I'm no coder at all, I am using this in my template index.php
<?php show_menu2(1, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_NUMCLASS|SM2_PRETTY, false, false); ?>
try this
shoes no Links in Level 2, only the menu_title
(remember , WB starts in LEVEL 0 (zero)
<?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)
Thanks but that code is throwing an error
I think the problem is a little typo.
Try this:
<?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>'
); ?>
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.
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
Thanks guys really appreciate this.
Now showing menu like this in my template
" title="Home">Home
About
" title="About">About
Contact
" title="Contact">Contact
Why Us
" title="Why Us">Why Us
and links like this
http://localhost/%3Cli%3E%3Ca%20href=
its testet now :oops:
<?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>
Thanks so much for your help, works exactly as I need it with
$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>',
cool :wink: