Lift fuer horizontales Sub-Menu? [solved]

Bitte alle templatebezogenen Beiträge in diesem Forum veröffentlichen.
Post Reply
User avatar
santscho
Posts: 1442
Joined: Mon 2. Apr 2007, 08:56
Location: Schweiz

Lift fuer horizontales Sub-Menu? [solved]

Post by santscho »

Wie man eine vertikale Unter-Navigation erstellt ist mittlerweile bekannt. Mit dem folgenden Skript bekomme ich meine gewuenschte Sub-Navi:

Code: Select all

    <?php
    // Direct call NAV_LIST_UL -> function buildCascadingMenu
    // ----------------------------------------------------------------
    // obligate check for phpwcms constants
    if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); }
    // ----------------------------------------------------------------

        $_vertmenu = '';

        if(isset($LEVEL_ID[1])) {

          $_vertmenu = trim(   buildCascadingMenu( 'F,' . $LEVEL_ID[2] . ',,act_path, active, id' )   );
          // this is exactly the same as {NAV_LIST_UL: F, start_level_id,,act_path, active, id }
          // but built with php function behind
          if( $_vertmenu ) {
                   $_vertmenu = '<!-- JS: {TEMPLATE}lib/sticky/sticky.js --> <div id="nav"><div class="subnavi">' . $_vertmenu . '</div></div>';
          } else {
            $_vertmenu = '';
          }
        }

        $content['all'] = str_replace( '{SUBNAVI1}', $_vertmenu, $content['all'] );
        ?>
Mit den richtigen CSS-Klassen, bekomme ich eine funktionierende horizontale Sub-Navigation. ABER das funktioniert nur solange die angezeigten Struktur-Ebenen keine weiteren Unterebenen enthalten. Falls doch, werden diese auch im horizontalen Menu ausgegeben und es verhaut die gesammte Navi. Unter-Ebenen moechte ich in diesem Menu komplett ignorieren und lieber als separate, weitere Unter-Navi ausgeben (horizontal oder vertikal in der Side-Bar).

Wie wohl? flip-flop?
Last edited by santscho on Tue 29. May 2012, 07:45, edited 1 time in total.
Schon Konfuzius sagte: "Sei kein YAML-Lappen". YAML-phpwcms-Integration auf http://www.yaml.phpwcms.org
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Lift fuer horizontales Sub-Menu?

Post by Oliver Georgi »

Limitiere schlicht die Zahl der Ebenen, die Du benötigst.

Code: Select all

$_vertmenu = trim(   buildCascadingMenu( 'F,' . $LEVEL_ID[2] . ', 1, act_path, active, id' )   );
Und Vorsicht, Du möchtest $LEVEL_ID[2], also muss es sein

Code: Select all

if(isset($LEVEL_ID[2])) {
Und somit am Ende

Code: Select all

if(isset($LEVEL_ID[2])) {
     $_vertmenu = trim(   buildCascadingMenu( 'F,' . $LEVEL_ID[2] . ', 1, act_path, active, id' )   );
     if( $_vertmenu ) {
           $_vertmenu = '<!-- JS: {TEMPLATE}lib/sticky/sticky.js --> <div id="nav"><div class="subnavi">' . $_vertmenu . '</div></div>';
     }
} else {
     $_vertmenu = '';
}
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
santscho
Posts: 1442
Joined: Mon 2. Apr 2007, 08:56
Location: Schweiz

Re: Lift fuer horizontales Sub-Menu?

Post by santscho »

Danke, Oliver. Das geht wunderbar!
Schon Konfuzius sagte: "Sei kein YAML-Lappen". YAML-phpwcms-Integration auf http://www.yaml.phpwcms.org
Post Reply