WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Show_Menu2 - everytime the same s*** :D
(1/1)
neu1886:
Hi everyone,
today i have a simple question but i can't find a solution. I have a main menu which only shows the level 0 items (top level). Clear, every top level page could have n..* subpages. If a top level page is selected, i want an output (second menu) like this
--- Code: ---HOME NEWS > EVENTS < (Main Menu)
--Menu 2--
EVENT 1
> EVENT 2 <
--- End code ---
I use this code for Menu 2:
--- Code: ---show_menu2(0, SM2_ROOT+1, SM2_START, SM2_ALL | SM2_PRETTY);
--- End code ---
But if i select EVENT 1...EVENT 2 etc. the menu vanish. But i want to have the Menu for each Subpage of EVENTS. How to realize this?
Thanks and sorry for the bad english!
dbs:
Hi, here my bad english answer ( there is also a german forum :wink: ).
You should show us the show_menu2 codes for main menu and for the submenu.
neu1886:
Code for the Main Menu:
--- Code: ---$openItem = '<li[if(class=menu-current||class=menu-parent){ class="active"}]><a href="[url]"><span data-hover="Home">[menu_title]</span></a>';
show_menu2(
$aMenu = 0,
$aStart = SM2_ROOT,
$aMaxLevel = SM2_START,
$aOptions = SM2_ALL | SM_PRETTY,
$aItemOpen = $openItem,
$aItemClose = '</li>',
$aMenuOpen = '<ul class="nav navbar-nav">',
$aMenuClose = '</ul>',
$aTopItemOpen = false,
$aTopMenuOpen = false
)
--- End code ---
Code for the Submenu:
--- Code: ---function hasSubmenu() {
$childs = show_menu2(0, SM2_CURR+1, SM2_START, SM2_BUFFER|SM2_ALL|SM2_CURRTREE);
return (!empty($childs)) ? true : false;
}
if(hasSubmenu()) {
$menuItem = '<li[if(class=menu-current||class=menu-parent){ class="active"}]><a href="[url]"><i class="g-mr-10 fa tab__fa fa-arrow-right"></i> [menu_title]</a>';
show_menu2(
$aMenu = 0,
$aStart = SM2_ROOT+1,
$aMaxLevel = SM2_START,
$aOptions = SM2_ALL | SM_PRETTY,
$aItemOpen = $menuItem,
$aItemClose = '</li>',
$aMenuOpen = '<ul class="nav nav-pills nav-stacked">',
$aMenuClose = '</ul>',
$aTopItemOpen = false,
$aTopMenuOpen = false
);
}
--- End code ---
It looks like hasSubmenu doesn't work correctly. :-(
dbs:
You can test in
--- Code: ---if(hasSubmenu()) { ...
...
$aStart = SM2_CURR+1,
--- End code ---
dbs:
and look here
--- Code: ---$aOptions = SM2_ALL | SM_PRETTY,
--- End code ---
should be
--- Code: ---$aOptions = SM2_ALL | SM2_PRETTY,
--- End code ---
Navigation
[0] Message Index
Go to full version