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 »
  • Show_Menu2: add specific string depending on parent
  • Print
Pages: [1]   Go Down

Author Topic: Show_Menu2: add specific string depending on parent  (Read 8225 times)

Offline ichmusshierweg

  • Posts: 49
Show_Menu2: add specific string depending on parent
« on: November 12, 2013, 02:26:20 PM »
Hi guys,

I've again problems to get the menu to work. Please take a look at the following menu-structure:

Quote
    <ul id="navlist" class="clearfix">
                    
                    <li><a href="index.html" >menu1</a></li>
                     <li><a href="#" rel="submenu1" >menu2</a>
                           <ul id="submenu1" class="ddsubmenustyle">
                               <li><a href="#">menu2-1</a></li>
                               <li><a href="#">menu2-2</a></li>
                                <li><a href="#">menu2-3</a></li>
                            </ul>
                     </li>
                    <li><a href="#" >menu3</a></li>
                    <li><a href="#" rel="submenu2" >menu4</a>
                           <ul id="submenu2" class="ddsubmenustyle">
                               <li><a href="#">menu4-1</a></li>
                               <li><a href="#">menu4-2</a></li>
                                <li><a href="#">menu4-3</a></li>
                            </ul>
                     </li>
                     <li><a href="#" >menu5</a></li>
                    
                </ul>

It's just about the string "submenu*" - do not care about the other stuff.
All menus which have a submenu should have a rel-attribute "submenu*". The "ul" of the submenu itselfs should have an "id="submenu*". They have to be the same, counting up and starting with "submenu1".  

I tried thinks like...
Quote
[if(id==6){<a href="[url]" rel="submenu1">[menu_title]</a>} ...

... but I failed because there ist no way to work with "elseif", or is there a way?

I really apprecciate your help.

Cheers
Karsten

« Last Edit: November 12, 2013, 02:42:53 PM by ichmusshierweg »
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Show_Menu2: add specific string depending on parent
« Reply #1 on: November 12, 2013, 02:45:02 PM »
Untested because i'm on my dayjob ;)

but this should push you in the right direction
Code: [Select]
<?php show_menu2(
    
$aMenu          = 0,
    
$aStart         = SM2_ROOT,
    
$aMaxLevel      = SM2_CURR+1,
    
$aOptions       = SM2_TRIM,
    
$aItemOpen      = '[li]<a href="[url]" target="[target]" [if(class==menu-expand){rel="submenu[page_id]"}] class="[class]">[menu_title]</a>',
    
$aItemClose     = '</li>',
    
$aMenuOpen      = '<ul id="[if(class==menu-expand){submenu[page_id]}]" class="[class] [if(class==menu-expand){rel="ddsubmenustyle"}]">',
    
$aMenuClose     = '</ul>',
    
$aTopItemOpen   = false,
    
$aTopMenuOpen   = '<ul id="navlist" class="clearfix">'
);
?>

Logged

Offline ichmusshierweg

  • Posts: 49
Re: Show_Menu2: add specific string depending on parent
« Reply #2 on: November 12, 2013, 03:19:24 PM »
Dear nibz,

that was really, really fast - thanks for your response.

Unfortunatly this is more or less the same I already tried an it is not working. The thing is, that that the first rel and id has to be "submenu1", second "submenu2" and so on. That s why I can not work with the page_id in this way.

My idea was to work with the page_ids like this:

Quote
  • <a href="[url]" target="[target]" [if(page_id==6){rel="submenu1"}
    elseif(page_id==7){rel="submenu1"}
    elseif(page_id==8){rel="submenu1"}
    ...
    elseif(page_id==9){rel="submenu2"}
    elseif(page_id==10){rel="submenu2"}
    elseif(page_id==11){rel="submenu2"}
    ...
    ] class="[class]">[menu_title]</a>
Unfortunatly it's not working, because I can't use "elseif" - or did I something completely wrong?

If there is a more elegant way to solve, i would really prefer it...

Thanks a lot
Karsten
Logged

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: Show_Menu2: add specific string depending on parent
« Reply #3 on: November 12, 2013, 05:10:15 PM »
Quote from: ichmusshierweg on November 12, 2013, 03:19:24 PM
Unfortunatly this is more or less the same I already tried an it is not working. The thing is, that that the first rel and id has to be "submenu1", second "submenu2" and so on. That s why I can not work with the page_id in this way.

Is it possible for you to work with like that:

at Level 0
Item 1: without children  no rel
Item 2: with children   rel="submenu2"
Item 3: without children  no rel
Item 4: with children  rel="submenu4"
Item 5: without children  no rel

if yes, i'll post the solution.
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 !

Offline ichmusshierweg

  • Posts: 49
Re: Show_Menu2: add specific string depending on parent
« Reply #4 on: November 12, 2013, 05:31:12 PM »
Quote from: DarkViper on November 12, 2013, 05:10:15 PM
Quote from: ichmusshierweg on November 12, 2013, 03:19:24 PM
Unfortunatly this is more or less the same I already tried an it is not working. The thing is, that that the first rel and id has to be "submenu1", second "submenu2" and so on. That s why I can not work with the page_id in this way.

Is it possible for you to work with like that:

at Level 0
Item 1: without children  no rel
Item 2: with children   rel="submenu2"
Item 3: without children  no rel
Item 4: with children  rel="submenu4"
Item 5: without children  no rel

if yes, i'll post the solution.

Hi darkviper,

at this time it seems not to be possible to proceed in this way. Im using the ddlevelsmeenu http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ and for some reason it seems to be mandatory to use submenu1, submenu2 and so on.
I already tried to modify the ddlevelsmenu.js to make it work with other rel-attributes and ids, because I thougt this might be a more easier way. Unfortunately I did find what to change in the mentioned .js file.

Thanks for your help
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Show_Menu2: add specific string depending on parent
« Reply #5 on: November 12, 2013, 09:09:28 PM »
Which overly complicated functions do you like about the menu?
Because it looks and feels the same as superfish menu: http://users.tpg.com.au/j_birch/plugins/superfish/examples/

Show menu2 code: http://jquery.lepton-cms.org/plugins/others/jq-superfish-sm2.php

Hope this helps :)
Logged

Offline ichmusshierweg

  • Posts: 49
Re: Show_Menu2: add specific string depending on parent
« Reply #6 on: November 20, 2013, 05:23:01 PM »
Quote from: DarkViper on November 12, 2013, 05:10:15 PM
Quote from: ichmusshierweg on November 12, 2013, 03:19:24 PM
Unfortunatly this is more or less the same I already tried an it is not working. The thing is, that that the first rel and id has to be "submenu1", second "submenu2" and so on. That s why I can not work with the page_id in this way.

Is it possible for you to work with like that:

at Level 0
Item 1: without children  no rel
Item 2: with children   rel="submenu2"
Item 3: without children  no rel
Item 4: with children  rel="submenu4"
Item 5: without children  no rel

if yes, i'll post the solution.

Hi dark viper,

I fixed something in the ddlevelsmenu and know I'm pretty sure it works, if the string of the rel and the corresponding id is the same. So your suggestion should work as well. Unfortunately still don't know how to solve this. I tried different ways with "page_id" and "parent", but I can't get it to work.

Would you please do me a favour and post your solution?

@nibz: Yes your are right. To use superfish would be a solution as well, but in this particular case I want to try this one.

Thanks a lot
Karsten
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Show_Menu2: add specific string depending on parent
 

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