2 Ebenen Navi

Wie verwendet man Templates oder erstellt Navigationen und passt diese an.

2 Ebenen Navi

Beitragvon kidloco66 » 23. Okt 2007, 11:56

Hallo leute,

habe die 2 Ebenen navi (Standard) und würde die gerne so verändern, dass die Child Ebene erst bei klick auf die parent Ebene herauskommt.

Der Code hier funktioniert, allerdings ohne aufklappen, ist gleich da:

Code: Alles auswählen
<?php
// EXPLODE PATH
$PATH = explode("|",$this->getValue("path").$this->getValue("article_id")."|");

// GET CURRENTS
$path1 = $PATH[1];
$path2 = $PATH[2];
$path3 = $PATH[3];

/* START 1st level categories */
$navLeftCol .= '<ul class="nav1st">';
foreach (OOCategory::getRootCategories() as $lev1) {
      
   if ($lev1->isOnline(true)):
      if ($lev1->getId() == $path1) {
         $navLeftCol .= '<li id="cat_'.$lev1->getId().'" class="active"><a class="current" href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
         if ($lev1->getId() != "1") {
            $sitePath .= ' ›› <a href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
         }
         $titlePath .= ' >> '.$lev1->getName();
      }
      // 1st level - no active link
      else {
         $navLeftCol .= '<li id="cat_'.$lev1->getId().'"><a href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
      }
         
      // 1st level had categories? -> go on
      $lev1Size = sizeof($lev1->getChildren());
   
      if ($lev1Size != "0"):
         $navLeftCol .= '<ul class="nav2nd">';


         // START 2nd level categories
         foreach ($lev1->getChildren() as $lev2):
                  
            if ($lev2->isOnline()):
   
            // 2nd level - active link
               if ($lev2->getId() == $path2) {
                  $navLeftCol .= '<li class="active"><a class="current" href="'.$lev2->getUrl().'">'.$lev2->getName().'</a></li>';
                  $sitePath .= ' ›› <a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
                  $titlePath .= ' >> '.$lev2->getName();
               }
               // 2nd level - no active link
               else {
                  $navLeftCol .= '<li><a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a></li>';
               }
         
            endif;         
            
         endforeach;
         // END 2nd level categories
      
         $navLeftCol .= '</ul>';
      endif; // END by if ($lev1Size != "0"):
      
      $navLeftCol .= '</li>';

   endif; // END by if ($lev1->isOnline())
}
$navLeftCol .= '</ul>';
// END 1st level categories


if ($REX['CUR_CLANG'] == 0) $breadcrumb = 'Sie sind hier: <a href="/index.php?clang=0">Start</a> '.$sitePath;
else $breadcrumb = '<a href="/cms/index.php">Start</a> '.$sitePath;

if ($REX['CUR_CLANG'] == 1) $breadcrumb = '<a href="/index.php?clang=1">Start</a> '.$sitePath;
else $breadcrumb = '<a href="/cms/index.php">Start</a> '.$sitePath;

if ($REX['CUR_CLANG'] == 2) $breadcrumb = '<a href="/index.php?clang=2">Start</a> '.$sitePath;
else $breadcrumb = '<a href="/cms/index.php">Start</a> '.$sitePath;

?>


Die zweite Datei bei der das ausklappen funktionert, aber leider nicht mehr das einbauen in die Seite (das Menü wird oben über der Seite und in der Seite an richtiger Position dargestellt). Was ich aber nicht verstehe. Aber hier auch mal dieser Code:

Code: Alles auswählen
<?php
// EXPLODE PATH
$PATH = explode("|",$this->getValue("path").$this->getValue("article_id")."|");

// GET CURRENTS
$path1 = $PATH[1];
$path2 = $PATH[2];
$path3 = $PATH[3];


/* START 1st level categories */
$navLeftCol .= '<ul class="nav1st">';
foreach (OOCategory::getRootCategories() as $lev1) {
     
   if ($lev1->isOnline(true)):
      if ($lev1->getId() == $path1) {
         $navLeftCol .= '<li class="active"><a class="current" href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
      }
      // 2nd level - no active link
      else {
         $navLeftCol .= '<li><a href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
      }
         
      // 1st level had categories? -> go on
      $lev1Size = sizeof($lev1->getChildren());
   
      if ($lev1->getId() == $path1) {
         if ($lev1Size != "0") {
            $navLeftCol .= '<ul class="nav2nd">';

            // START 2nd level categories
            foreach ($lev1->getChildren() as $lev2):
               if ($lev2->isOnline(true)) {
                  // 2nd level - active link
                  if ($lev2->getId() == $path2) {
                     $navLeftCol .= '<li class="active"><a class="current" href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
                  }
                  // 2nd level - no active link
                  else {
                     $navLeftCol .= '<li><a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
                  }
                 
                  // 2nd level had categories? -> go on
                  $lev2Size = sizeof($lev2->getChildren());
   
                  if ($lev2->getId() == $path2) {
                     if ($lev2Size != "0") {
                        $navLeftCol .= '<ul class="nav3rd">';

                        // START 3rd level categories
                        foreach ($lev2->getChildren() as $lev3):
                           if ($lev3->isOnline(true)) {
                              // 3rd level - active link
                              if ($lev3->getId() == $path3) {
                                 $navLeftCol .= '<li class="active"><a class="current" href="'.$lev3->getUrl().'">'.$lev3->getName().'</a></li>';
                              }
                              // 3rd level - no active link
                              else {
                                 $navLeftCol .= '<li><a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a></li>';
                              }
                           }
                        endforeach;
                        // END 3rd level categories
     
                        $navLeftCol .= '</ul>';
                     } // END by if ($lev2Size != "0"):
                  }
                  $navLeftCol .= '</li>';
               }
            endforeach;
            // END 2nd level categories
     
            $navLeftCol .= '</ul>';
         } // END by if ($lev1Size != "0"):
      }
      $navLeftCol .= '</li>';

   endif; // END by if ($lev1->isOnline())
}
$navLeftCol .= '</ul>';
// END 1st level categories

print $navLeftCol;
?>



Bin über jeden Rat dankbar.

Gruss Kid
kidloco66
 
Beiträge: 60
Registriert: 1. Okt 2007, 13:32

Beitragvon kidloco66 » 24. Okt 2007, 10:42

Moin Leute,

ich stelle meine Frage noch mal einfacher.

Möchte eigentlich nur wissen welcher Befehl für das sofortige Anzeigen der 2. Ebene verantwortlich ist.

Danke.
kidloco66
 
Beiträge: 60
Registriert: 1. Okt 2007, 13:32

Beitragvon therancher » 24. Okt 2007, 20:41

hi, warum nimmst du nicht die hier: http://www.redaxo.de/168-Templatedetails.html?template_id=14
gruss, HarryT
spontanität will wohl überlegt sein!
therancher
 
Beiträge: 489
Registriert: 29. Jan 2007, 17:32
Wohnort: Sachsen

Beitragvon kidloco66 » 25. Okt 2007, 11:52

Hey therancher,

das war ja auch der den ich da oben genannt hatte.

Der war nur immer zweimal in meiner Seite drin.

Da hab natürlich auch nicht richtig hingeguckt, den der Fehler war:

GANZ UNTEN STEHT

print $navLeftCol;

UND DANN IST NATÜRLICH KLAR DAS ER DAS ZWEIMAL BRINGT!

Vielleicht hilft meine kleine Erkenntnis jan jemanden was ;)

Danke und Gruss

Kid
kidloco66
 
Beiträge: 60
Registriert: 1. Okt 2007, 13:32

Beitragvon Kesrkin » 26. Okt 2007, 12:14

nenne doch einfach die Childcat von $navLeftcol in $nacSubcol

generiere dir eine eigene Css dafür wo du sie sehen willst.

bei nachLeftCol steht dann nur die Hauptkategorie drin und wenn du darauf klickst sollte die NavSubCol erscheinen.

So sind am Anfang nur die Hauptmenueinträge sichtbar und dann halt die Subs
Kesrkin
 
Beiträge: 5
Registriert: 4. Okt 2007, 09:21

Beitragvon therancher » 26. Okt 2007, 17:28

das ding war doch schon fertig... er hatte sie nur 2x eingebaut..., hatte ich auch überlesen :D
spontanität will wohl überlegt sein!
therancher
 
Beiträge: 489
Registriert: 29. Jan 2007, 17:32
Wohnort: Sachsen


Zurück zu Templates/Navigationen [R3]

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast

cron