[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 213: Undefined array key "FORUM_NAME"
Navigation: 4 statt 3 Ebenen - REDAXO Forum
Hallo,

Wir haben in letzter Zeit festgestellt, dass die Kommunikation via Slack viel schneller und zielführender ist als ein Beitrag im Forum. Aufgrund der neuen und besseren Möglichkeiten der Kommunikation haben wir uns entschlossen das Forum nur noch als Archiv zur Verfügung zu stellen. Somit bleibt es weiterhin möglich hier nach Lösungen zu suchen. Neue Beiträge können nicht mehr erstellt werden.

Wir empfehlen, für deine Fragen/Probleme Slack zu nutzen. Dort sind viele kompetente Benutzer aktiv und beantworten jegliche Fragen, gerne auch von REDAXO-Anfängern! Slack wird von uns sehr intensiv und meistens "rund um die Uhr" benutzt :-)
Selbst einladen kannst Du dich hier: https://redaxo.org/slack/
rabby
Beiträge: 25
Registriert: 28. Okt 2006, 17:42
Kontaktdaten: Website

Navigation: 4 statt 3 Ebenen

15. Aug 2007, 15:25

Hi,
momentan hab ich folgenden Code, der die Navigation erzeugt:
<?php
// EXPLODE PATH
$PATH = explode("|",$this->getValue("path").$this->getValue("article_id")."|");

// GET CURRENTS
$path1 = $PATH[1];
$path2 = $PATH[2];
$path3 = $PATH[3];
$path4 = $PATH[4];
$path5 = $PATH[5];

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

// START 2nd level categories
foreach ($lev1->getChildren() as $lev2):

if ($lev2->isOnline()):

// 2nd level - active link
if ($lev2->getId() == $path2) {

$navLeftCol .= "\r\n\t"."\t"."\t".'<li class="active"><a class="current" href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
$sitePath .= ' ›› <a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
$titlePath .= ' >> '.$lev2->getName();
}
// 2nd level - no active link
else {
$navLeftCol .= "\r\n\t"."\t"."\t".'<li><a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a></li>'."\r\n";
}

// 2st level had categories? -> go on
$lev2Size = sizeof($lev2->getChildren());

if ($lev2->getId() == $path2) {
if ($lev2Size != "0"):
$navLeftCol .= '</li>'."\r\n"."\t"."\t"."\t".'<li><ul class="nav3rd">'."\r\n";

// START 3nd level categories
foreach ($lev2->getChildren() as $lev3):

if ($lev3->isOnline()):

// 3nd level - active link
if ($lev3->getId() == $path3) {
$navLeftCol .= "\r\n\t"."\t"."\t"."\t".'<li class="active"><a class="current" href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
$sitePath .= ' ›› <a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
$titlePath .= ' >> '.$lev3->getName();
}
// 3nd level - no active link
else {
$navLeftCol .= "\t"."\t"."\t"."\t".'<li><a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
}

endif;
$navLeftCol .= '</li>'."\r\n";
endforeach;
$navLeftCol .= "\t"."\t"."\t".'</ul>'."\r\n";
// END 3nd level categories
endif;
$navLeftCol .= "\t"."\t\t".'</li>'."\r\n";
}
// END 2nd level categories
endif; // END by if ($lev1Size != "0"):
endforeach;
//$navHeader .= "\t".'</li>'."\r\n";
endif;
if ($navLeftCol != "") $navLeftCol .= "\t\t ".'</ul>'."\r\n"."\t"."</li>\r\n";
}
endif; // END by if ($lev1->isOnline())
}
$navHeader .= '</ul>'."\r\n";

// END 1st level categories

if ($REX['CUR_CLANG'] == 1) $breadcrumb = 'You are here: <a href="/index.php?clang=1">Startpage</a> '.$sitePath;
else $breadcrumb = 'Sie sind hier: <a href="/index.php">Startseite</a> '.$sitePath;
?>
Doch nun würde ich gerne noch eine 4. Ebenenstufe dazuhaben.
Habe einiges probiert; kam aber nicht auf den richtigen Code.

Schönen tlw. Feiertag noch.

Benutzeravatar
n.ruediger
Beiträge: 405
Registriert: 21. Mär 2007, 12:25
Wohnort: Frankfurt (Oder)
Kontaktdaten: ICQ Website Yahoo Messenger

17. Aug 2007, 21:28

Hallo,

versuch mal das hier:

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];
  $path4 = $PATH[4];
  $path5 = $PATH[5];

  /* START 1st level categories */
  $navHeader .= "\r\n".'<ul id="Navigation">'."\r\n";
  $navLeftCol='';

  foreach (OOCategory::getRootCategories() as $lev1) {
    if ($lev1->isOnline()) {         
      // 1nd level - active link
      if ($lev1->getId() == $path1) {
        $navHeader .= "\t".'<li class="active"><a class="current" href="'.$lev1->getUrl().'">'.$lev1->getName().'</a></li><!--deep_nav-->'."\r\n";
        if ($lev1->getId() != "1") {
          $sitePath .= ' ›› <a href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
        }
        $titlePath .= ' >> '.$lev1->getName();
      }
      // 1nd level - no active link
      else {
        $navHeader .= "\t".'<li><a href="'.$lev1->getUrl().'">'.$lev1->getName().'</a></li>'."\r\n";
      }

      // 1st level had categories? -> go on
      $lev1Size = sizeof($lev1->getChildren());
      if ($lev1->getId() == $path1) {
        if ($lev1Size != "0") {
          $navLeftCol .= "\r\n"."\t"."<li id=\"nav2nd\"><!--fehler-->\r\n"."\t"."\t".'<ul>'."\r\n";

          // START 2nd level categories
          foreach ($lev1->getChildren() as $lev2) {
            if ($lev2->isOnline()) {
              // 2nd level - active link
              if ($lev2->getId() == $path2) {
                $navLeftCol .= "\r\n\t"."\t"."\t".'<li class="active"><a class="current" href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
                $sitePath .= ' ›› <a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a>';
                $titlePath .= ' >> '.$lev2->getName();
              }
              // 2nd level - no active link
              else {
                $navLeftCol .= "\r\n\t"."\t"."\t".'<li><a href="'.$lev2->getUrl().'">'.$lev2->getName().'</a></li>'."\r\n";
              }

              // 2st level had categories? -> go on
              $lev2Size = sizeof($lev2->getChildren());
              if ($lev2->getId() == $path2) {
                if ($lev2Size != "0") {
                  $navLeftCol .= '</li>'."\r\n"."\t"."\t"."\t".'<li><ul class="nav3rd">'."\r\n";

                  // START 3nd level categories
                  foreach ($lev2->getChildren() as $lev3) {
                    if ($lev3->isOnline()) {
                      // 3nd level - active link
                      if ($lev3->getId() == $path3) {
                        $navLeftCol .= "\r\n\t"."\t"."\t"."\t".'<li class="active"><a class="current" href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
                        $sitePath .= ' ›› <a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
                        $titlePath .= ' >> '.$lev3->getName();  
                        
                        $lev3Size = sizeof($lev3->getChildren());
                        if ($lev3->getId() == $path3) {
                          if ($lev3Size != "0") {                                               
                            $navLeftCol .= '</li>'."\r\n"."\t"."\t"."\t".'<li><ul class="nav3rd">'."\r\n";
                            
                            // START 4th level categories
                            foreach ($lev3->getChildren() as $lev4) {
                              if ($lev4->isOnline()) {
                                // 4nd level - active link
                                if ($lev4->getId() == $path4) {
                                  $navLeftCol .= "\r\n\t"."\t"."\t"."\t".'<li class="active"><a class="current" href="'.$lev4->getUrl().'">'.$lev4->getName().'</a>';
                                  $sitePath .= ' ›› <a href="'.$lev4->getUrl().'">'.$lev4->getName().'</a>';
                                  $titlePath .= ' >> '.$lev4->getName();  
                                }
                                // 4nd level - no active link
                                else {
                                  $navLeftCol .= "\t"."\t"."\t"."\t".'<li><a href="'.$lev4->getUrl().'">'.$lev4->getName().'</a>';
                                }                                                                                                     
                              }
                            }
                          }
                        }
                      }
                      // 3nd level - no active link
                      else {
                        $navLeftCol .= "\t"."\t"."\t"."\t".'<li><a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
                      }
                    }
                    $navLeftCol .= '</li>'."\r\n";
                  }
                  $navLeftCol .= "\t"."\t"."\t".'</ul>'."\r\n";
                  // END 3nd level categories
                }
                $navLeftCol .= "\t"."\t\t".'</li>'."\r\n";
              }
              // END 2nd level categories
            }
          }
          //$navHeader .= "\t".'</li>'."\r\n";
        }
        if ($navLeftCol != "") $navLeftCol .= "\t\t ".'</ul>'."\r\n"."\t"."</li>\r\n";
      }
    }
  }
  $navHeader .= '</ul>'."\r\n";
  // END 1st level categories

  if ($REX['CUR_CLANG'] == 1) $breadcrumb = 'You are here: <a href="/index.php?clang=1">Startpage</a> '.$sitePath;
  else $breadcrumb = 'Sie sind hier: <a href="/index.php">Startseite</a> '.$sitePath;
?>
Liebe Grüße,
Nicole

Zurück zu „Allgemeines [R3]“