WebsiteBaker Community Forum
WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: ichmusshierweg 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:
<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...
[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
-
Untested because i'm on my dayjob ;)
but this should push you in the right direction
<?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">'
);
?>
-
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:
- <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
-
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.
-
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/ (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
-
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 :)
-
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