Author Topic: Show_Menu2 - everytime the same s*** :D  (Read 572 times)

Offline neu1886

  • Posts: 10
Show_Menu2 - everytime the same s*** :D
« on: June 06, 2017, 01:12:11 AM »
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: [Select]
HOME   NEWS   > EVENTS < (Main Menu)

--Menu 2--
EVENT 1
> EVENT 2 <

I use this code for Menu 2:

Code: [Select]
show_menu2(0, SM2_ROOT+1, SM2_START, SM2_ALL | SM2_PRETTY);
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!

Offline dbs

  • Betatester
  • **
  • Posts: 7490
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Show_Menu2 - everytime the same s*** :D
« Reply #1 on: June 06, 2017, 08:16:25 AM »
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.

Offline neu1886

  • Posts: 10
Re: Show_Menu2 - everytime the same s*** :D
« Reply #2 on: June 06, 2017, 11:44:10 AM »
Code for the Main Menu:

Code: [Select]
$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
)

Code for the Submenu:

Code: [Select]
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
);
}

It looks like hasSubmenu doesn't work correctly.  :-(

Offline dbs

  • Betatester
  • **
  • Posts: 7490
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Show_Menu2 - everytime the same s*** :D
« Reply #3 on: June 06, 2017, 02:46:04 PM »
You can test in
Code: [Select]
if(hasSubmenu()) { ...
...
$aStart         = SM2_CURR+1,

Offline dbs

  • Betatester
  • **
  • Posts: 7490
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Show_Menu2 - everytime the same s*** :D
« Reply #4 on: June 06, 2017, 06:21:26 PM »
and look here
Code: [Select]
$aOptions       = SM2_ALL | SM_PRETTY,should be
Code: [Select]
$aOptions       = SM2_ALL | SM2_PRETTY,