Menu with one step without links


daydreamer

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>',

jacobi22

#24
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>

daydreamer

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=

jacobi22

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

nibz

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.


nibz

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>'
        
); ?>

daydreamer

Thanks but that code is throwing an error

jacobi22

#17
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)

daydreamer

I'm no coder at all, I am using this in my template index.php

<?php show_menu2(1SM2_ROOTSM2_ALLSM2_ALL|SM2_NUMCLASS|SM2_PRETTYfalsefalse); ?>

jacobi22

#15
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">'
        
); ?>

daydreamer

Is it right adding it in modules/showmenu2.includes.php ?

daydreamer

Thanks but still does nothing at all  :?

jacobi22

missing the () arround the question  -> if (level=2)
$aItemOpen      = '[if (level=2) {<li>[menu_title]} else {<li>[a][menu_title]</a>}]',

daydreamer

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

davidwaterman

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.

Stefek

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
[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

viiksi

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) {<...

Stefek

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
[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

viiksi

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

DarkViper

#5
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:
[url=http://www.youtube.com/watch?v=tmzDAz6ZvFQ]Der blaue Planet[/url] - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen[br]
[i]"You have to take the men as they are... but you can not leave them like that !" :-P [/i]
[i]Das tägliche Stoßgebet: [b]Oh Herr, wirf Hirn vom Himmel ![/b][/i]

Stefek

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
[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

viiksi

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


Stefek

#2
You can use just sm2 for this.

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

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