WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Show_Menu2: two level menu --> output in one level
  • Print
Pages: [1]   Go Down

Author Topic: Show_Menu2: two level menu --> output in one level  (Read 7462 times)

Offline ichmusshierweg

  • Posts: 49
Show_Menu2: two level menu --> output in one level
« on: September 13, 2013, 01:08:29 PM »
Hi,

I got a real problem and have no clue how to solve it. My menu-structure looks like this:

- home
- about
-- about1
-- about2
- something
-- something1
-- something2

The code looks like this:
Code: [Select]
<ul>
<li><a href="home.php">home</a></li>
<li><a href="about.php">about</a>
<ul>
<li><a href="about/about1.php">about1</a></li>
<li><a href="about/about2.php">about2</a></li>
</ul>
</li>
<li><a href="something.php">something</a>
<ul>
<li><a href="something/something.php">something1</a></li>
<li><a href="something/something2.php">something2</a></li>
</ul>
</li>

For some reason I need to have all item of the TWO-LEVEL-MENU in ONE-LEVEL. This should look like this:
Code: [Select]
<ul class="dropdown-menu">
<li><a href="home.php" class="active_1">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="about/about1.php">-- About1</a></li>
<li><a href="about/about2.php">-- About2</a></li>
<li><a href="something.php">something</a></li>
<li><a href="something/something1.php">-- something1</a></li>
<li><a href="something/something2.php">-- something2</a></li>
</ul>

So the <li>s of the 2nd level have to appear in the 1st level.

Does anybody have an idea how to solve this? I read the documentation a hundret times but still don't know how to do.

I really apprechiate your help!

Thanks a lot
Karsten
« Last Edit: September 13, 2013, 01:17:47 PM by ichmusshierweg »
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Show_Menu2: two level menu --> output in one level
« Reply #1 on: September 13, 2013, 01:51:06 PM »
This should work:
Code: [Select]
<ul class="dropdown-menu">
<?php show_menu2(
    
$aMenu          = 1,
    
$aStart         = SM2_ROOT,
    
$aMaxLevel      = SM2_ALL,
    
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
    
$aItemOpen      = '<li><a href="[url]" class="[if(class==menu-current){active_1}]">[if(level=1){-- }][menu_title]</a></li>',
    
$aItemClose     = '',
    
$aMenuOpen      = '',
    
$aMenuClose     = '',
    
$aTopItemOpen   = false,
    
$aTopMenuOpen   = false
);?>

</ul>

dont know if you need the -- but i put them in with: [if(level=1){-- }]

13/09/13 14:27 updated code
« Last Edit: September 13, 2013, 02:26:24 PM by nibz »
Logged

Offline ichmusshierweg

  • Posts: 49
Re: Show_Menu2: two level menu --> output in one level
« Reply #2 on: September 13, 2013, 02:10:15 PM »
Quote from: nibz on September 13, 2013, 01:51:06 PM
This should work:
Code: [Select]
<ul class="dropdown-menu">
<?php show_menu2(
    
$aMenu          = 1,
    
$aStart         = SM2_ROOT,
    
$aMaxLevel      = SM2_ALL,
    
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
    
$aItemOpen      = '<li><a href="[url]" class="[if(class==menu-current){active_1}]">[if(level=1){-- }][menu_title]</a>',
    
$aItemClose     = '</li>',
    
$aMenuOpen      = '',
    
$aMenuClose     = '',
    
$aTopItemOpen   = false,
    
$aTopMenuOpen   = false
);?>

</ul>

dont know if you need the -- but i put them in with: [if(level=1){-- }]

Hi NIBZ,

thanks for your quick an proper response. It works almost perfect, but the closing li-tags are on the wrong place.
Code: [Select]
<ul class="dropdown-menu">

<!-- show_menu2 -->
 
    <li><a href="/cms" class="">Home</a>    </li>
    <li><a href="/cms/page/menu1.php" class="">menu1</a>
     
        <li><a href="/cms/page/menu1/menu1-1.php" class="">-- menu1-1</a>        </li>
        <li><a href="/cms/page/menu1/menu1-2.php" class="">-- menu1-2</a>        </li>
     
    </li>
    <li><a href="/cms/page/menu2.php" class="">menu2</a>
     
        <li><a href="/cms/page/menu2/menu2-1.php" class="active_1">-- menu2-1</a>        </li>
        <li><a href="/cms/page/menu2/menu2-2.php" class="">-- menu2-2</a>        </li>
     
    </li>
 

</ul>

Again any idea how to fix this?

Meanwhile it tried something completly different, but it's still not working.
Code: [Select]
<?php show_menu2(
$aMenu = 0,
$aStart = SM2_ROOT,
$aMaxLevel = SM2_ALL,
$aOptions = SM2_NUMCLASS,
$aItemOpen = '[li][a][menu_title]</a>',
$aItemClose = '',
$aMenuOpen = '',
$aMenuClose = '',
$aTopItemOpen = '<ul class="dropdown-menu">',
$aTopMenuOpen = ''
) ; ?>

Unfortunatly I've to go to a marriage now. Tomorow I will try again.

Thanks for your help!
Karsten
Logged

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Show_Menu2: two level menu --> output in one level
« Reply #3 on: September 13, 2013, 02:25:33 PM »
This should work (also updated the other code, there was a little mistake),

Code: [Select]
<ul class="dropdown-menu">
<?php show_menu2(
    
$aMenu          = 1,
    
$aStart         = SM2_ROOT,
    
$aMaxLevel      = SM2_ALL,
    
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
    
$aItemOpen      = '<li><a href="[url]" class="[if(class==menu-current){active_1}]">[if(level=1){-- }][menu_title]</a></li>',
    
$aItemClose     = '',
    
$aMenuOpen      = '',
    
$aMenuClose     = '',
    
$aTopItemOpen   = false,
    
$aTopMenuOpen   = false
);?>

</ul>
Logged

Offline ichmusshierweg

  • Posts: 49
Re: Show_Menu2: two level menu --> output in one level
« Reply #4 on: September 15, 2013, 09:57:01 AM »
Quote from: nibz on September 13, 2013, 02:25:33 PM
This should work (also updated the other code, there was a little mistake),

Code: [Select]
<ul class="dropdown-menu">
<?php show_menu2(
    
$aMenu          = 1,
    
$aStart         = SM2_ROOT,
    
$aMaxLevel      = SM2_ALL,
    
$aOptions       = SM2_ALL|SM2_NUMCLASS|SM2_PRETTY,
    
$aItemOpen      = '<li><a href="[url]" class="[if(class==menu-current){active_1}]">[if(level=1){-- }][menu_title]</a></li>',
    
$aItemClose     = '',
    
$aMenuOpen      = '',
    
$aMenuClose     = '',
    
$aTopItemOpen   = false,
    
$aTopMenuOpen   = false
);?>

</ul>

Hi nibz,

this works out absolut perfect. Thank you very much for your help. You did't me great favour.

Cheers
Karsten
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Show_Menu2: two level menu --> output in one level
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2