WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Show_Menu2: add specific string depending on parent
ichmusshierweg:
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>
--- End quote ---
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>} ...
--- End quote ---
... but I failed because there ist no way to work with "elseif", or is there a way?
I really apprecciate your help.
Cheers
Karsten
nibz:
Untested because i'm on my dayjob ;)
but this should push you in the right direction
--- Code: ---<?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">'
);
?>
--- End code ---
ichmusshierweg:
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>
--- End quote ---
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
DarkViper:
--- 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.
--- End quote ---
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.
ichmusshierweg:
--- 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.
--- End quote ---
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.
--- End quote ---
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
Navigation
[0] Message Index
[#] Next page
Go to full version