Show_Menu2: two level menu --> output in one level

ichmusshierweg

Quote from: nibz on September 13, 2013, 02:25:33 PM
This should work (also updated the other code, there was a little mistake),


<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

nibz

This should work (also updated the other code, there was a little mistake),


<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>

ichmusshierweg

Quote from: nibz on September 13, 2013, 01:51:06 PM
This should work:

<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.
<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.
<?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

nibz

#2
This should work:

<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

ichmusshierweg

#1
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:

<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:

<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