WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Menu with sub text?
evaki:
Ja, schöner Vorschlag von DarkViper
Entdecke gerade, daß mir noch active_page bzw actives menu fehlt, z.Z. ist nur die Schriftfarbe aktiv.
Da sollte auch der Hintergrund noch dunkler sein.
Schaun wir mal :-D (p.s. Wie meist, wieder maln Schreibfehler dabei)
MfG. Evaki
Boudi:
Great post. Was looking for something like this to implement in a bootstrap code and it works (be sure to delete the class="sf-menu")
Roych:
Hello, back here again :|
I'm working on a new site and I'm having trouble with submenu for this kind of menu.
Code:
--- Code: --- <ul class="nav sf-menu clearfix">
<li class="active"><a href="#"><div class="over1"></div><div class="over2"></div><div class="txt1">Home</div><div class="txt2">start here</div></a></li>
<li class="sub-menu sub-menu-1"><a href="#"><div class="over1"></div><div class="over2"></div><div class="txt1">About</div><div class="txt2">Who are we?</div></a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Dolor sit</a></li>
<li><a href="#">Sit amet</a></li>
<li><a href="#">404 page</a></li>
</ul>
</li>
<li><a href="#"><div class="over1"></div><div class="over2"></div><div class="txt1">Gallery</div><div class="txt2">photos</div></a></li>
<li><a href="#"><div class="over1"></div><div class="over2"></div><div class="txt1">Contacts</div><div class="txt2">mail us</div></a></li>
</ul>
--- End code ---
I made this and the main menu works great:
--- Code: ---<?php show_menu2(
$aMenu = 1,
$aStart = SM2_ROOT,
$aMaxLevel = SM2_ALL,
$aOptions = SM2_ALL|SM2_PRETTY,
$aItemOpen = '[li][a]<div class="over1"></div><div class="over2"></div><div class="txt1">[menu_title]</div><div class="txt2">[page_title]</div></a>',
$aItemClose = '</li>',
$aMenuOpen = '<ul class="nav clearfix">',
$aMenuClose = '</ul>',
$aTopItemOpen = false,
$aTopMenuOpen = false,
$alastbutton = true
); ?>
--- End code ---
But the submenu is the same as the main menu. I tried all kind of things but cant figure it out with the submenu classes...
any ideas?
Thank you very much
R.
instantflorian:
Have a look at the sm2 documentation chapter "Conditional formatting"
Tutorial link removed 404
(quite far down)
--- Code: ---[if(class==menu-expand){exp}]
--- End code ---
So you can place special classes if an item has sub-items.
But what does this
--- Code: ---sub-menu-1
--- End code ---
mean? Does every sub-menu need its own class or is it the level of the submenu?
In the first case, this could be a problem, because afaik there is no way to count the entries of the menu at a certain level.
hth
-Florian.
jacobi22:
1. $alastbutton is not a part of the original show-menu-function
2. a good example for a menu like yours is the code from nibz here
see there the code like florian's example
[if(class==menu-expand){exp}]
means
if there is a class called menu-expand, do this, what you found between { and } (like {exp}.
{exp} can be also a longer definition like your example. (different HTML-Output for every Menu-Level is possible)
See also the method from nibz, where he define $open in a extra line
3. $aTopItemOpen && $aTopMenuOpen
see Readme
$aTopItemOpen
Format string for the first item. When set to false, it uses the same
format as $aItemOpen.
$aTopMenuOpen
Format string for the first menu. When set to false, it uses the same
format as $aMenuOpen.
if you need a different between main menu and submenu in the ul-tag, use a definition like this
--- Code: ---<?php
........
$aMenuOpen = '<ul class="subnav">',
$aMenuClose = '</ul>',
$aTopItemOpen = '<ul class="mainnav">',
$aTopMenuOpen = '</ul>'
--- End code ---
means: every new list in a sub-menu started with <ul class="subnav">
--- Code: ---<?php
$aMenuOpen = '<ul class="subnav[level]">',
--- End code ---
add the level to the subnav-class (subnav1, subnav2 etc). You can define different classes for every Level
like
--- Code: ---ul.subnav1 li {background-color:#ff0000; }
ul.subnav2 li {background-color:#ffff00; }
--- End code ---
4. [sib] counts the menu-parts on the actual level and! in this menu tree, startet with 1, counting startet new in every menu tree
5. [sibCounts] is the sum of all elements in this menu tree and this level
6. SM2_NUMCLASS Add the numbered menu classes to the menu. Example: all items on level==0 becomes the class menu-0
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version