Ein großes Lob an die Entwickler!
Aber nun zu meinem Problem:
Ich habe die Navigation aus der Demo entnommen und etwas angepasst, nun möchte ich eine dritte Ebene einfügen. Die aufklappt, wenn man einen Link der zweiten Ebene anklickt.
Leider bekomme ich folgenden Error ausgegeben:
Fatal error: Call to a member function getChildren() on a non-object in D:\xampp\htdocs\redaxo_2\redaxo\include\classes\class.article.inc.php(443) : eval()'d code on line 64
- 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];
/* START 1st level categories */
$navHeader .= '<ul class="nav1st">';
foreach (OOCategory::getRootCategories() as $lev1) {
if ($lev1->isOnline()):
if ($lev1->getId() == $path1) {
$navHeader .= '<li class="kat1st"><a class="current_link1st" href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
if ($lev1->getId() != "1") {
$sitePath .= ' ›› <a class="link1st" href="'.$lev1->getUrl().'">'.$lev1->getName().'</a>';
}
$titlePath .= ' >> '.$lev1->getName();
}
// 2nd level - no active link
else {
$navHeader .= '<li class="kat1st"><a class="link1st" 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()):
// 2nd level - active link
if ($lev2->getId() == $path2) {
$navLeftCol .= '<li class="kat2nd"><a class="current_link2nd" 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 class="kat2nd"><a class="link2nd"href="'.$lev2->getUrl().'">'.$lev2->getName().'</a></li>';
}
endif;
endforeach;
$navLeftCol .= '</ul>';
endif; // END by if ($lev1Size != "0"):
}
// 2nd level had categories? -> go on
$lev2Size = sizeof($lev2->getChildren());
if ($lev2->getId() == $path3) {
if ($lev2Size != "0"):
$navLeftCol3 .= '<ul class="nav3rd">';
// START 3rd level categories
foreach ($lev2->getChildren() as $lev3):
if ($lev3->isOnline()):
// 3rd level - active link
if ($lev3->getId() == $path3) {
$navLeftCol3 .= '<li class="kat3rd"><a class="current_link3rd" href="'.$lev3->getUrl().'">'.$lev3->getName().'</a></li>';
$sitePath .= ' ›› <a href="'.$lev3->getUrl().'">'.$lev3->getName().'</a>';
$titlePath .= ' >> '.$lev3->getName();
}
// 3rd level - no active link
else {
$navLeftCol3 .= '<li class="kat3rd"><a class="link3rd"href="'.$lev3->getUrl().'">'.$lev3->getName().'</a></li>';
}
endif;
endforeach;
$navLeftCol3 .= '</ul>';
endif; // END by if ($lev1Size != "0"):
}
$navHeader .= '</li>';
endif; // END by if ($lev1->isOnline())
}
$navHeader .= '</ul>';
// END 1st level categories
print $navHeader;
print $navLeftCol;
print $navLeftCol3;
?>

