Ich habe folgende Navigation die ich als Template einbaue (in diesem Fall nur der Teil der die ul/li generiert):
Code: Alles auswählen
<?php
$PATH = explode("|", $this -> getValue("path") . $this -> getValue("article_id") . "|");
echo '<ul class="nav navbar-nav rechtsbuendig">';
foreach (rex_category::getRootCategories() as $lev1) {
if ($lev1 -> isOnline(true)) {
if ($lev1 -> getId() == $PATH[1]) {
if (count($lev1 -> getChildren()) > 0) {
echo '<li class="dropdown active"><a class="dropdown-toggle" data-toggle="dropdown" href="' . $lev1 -> getUrl() . '" title="' . $lev1 -> getName() . '">' . $lev1 -> getName() . '</a>';
} else {
echo '<li class="active"><a href="' . $lev1 -> getUrl() . '" title="' . $lev1 -> getName() . '">' . $lev1 -> getName() . '</a>';
}
} else {
if (count($lev1 -> getChildren()) > 0) {
echo '<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="' . $lev1 -> getUrl() . '" title="' . $lev1 -> getName() . '">' . $lev1 -> getName() . '</a>';
} else {
echo '<li><a href="' . $lev1 -> getUrl() . '" title="' . $lev1 -> getName() . '">' . $lev1 -> getName() . '</a>';
}
}
}
if (count($lev1 -> getChildren()) > 0) {
echo '<ul class="dropdown-menu sub1">';
foreach ($lev1->getChildren() as $lev2) {
if ($lev2 -> isOnline(true)) {
if ($lev2 -> getId() == $PATH[1]) {
$dropdownSub = "";
if (count($lev2 -> getChildren()) > 0)
$dropdownSub = "dropdown-submenu";
echo '<li class="active ' . $dropdownSub . '"><a tabindex="-1" href="' . $lev2 -> getUrl() . '" title="' . $lev2 -> getName() . '">';
echo $lev2 -> getName();
echo '</a>';
if (count($lev2 -> getChildren()) > 0) {
echo '<ul class="dropdown-menu">';
foreach ($lev2->getChildren() as $lev3) {
if ($lev3 -> getId() == $PATH[2])
echo '<li class="active"><a href="' . $lev3 -> getUrl() . '" title="' . $lev3 -> getName() . '">' . $lev3 -> getName() . '</a></li>';
else
echo '<li><a href="' . $lev3 -> getUrl() . '" title="' . $lev3 -> getName() . '">' . $lev3 -> getName() . '</a></li>';
}
echo '</ul>';
}
} else {
$dropdownSub = "";
if (count($lev2 -> getChildren()) > 0)
$dropdownSub = "dropdown-submenu-2";
echo '<li class="' . $dropdownSub . '"><a tabindex="-1" href="' . $lev2 -> getUrl() . '" title="' . $lev2 -> getName() . '">';
echo $lev2 -> getName();
echo '</a>';
if (count($lev2 -> getChildren()) > 0) {
echo '<ul class="dropdown-menu sub2">';
foreach ($lev2->getChildren() as $lev3) {
if ($lev3 -> getId() == $PATH[2])
echo '<li class="active"><a href="' . $lev3 -> getUrl() . '" title="' . $lev3 -> getName() . '">' . $lev3 -> getName() . '</a></li>';
else
echo '<li><a href="' . $lev3 -> getUrl() . '" title="' . $lev3 -> getName() . '">' . $lev3 -> getName() . '</a></li>';
}
echo '</ul>';
}
}
}
if ($lev2 -> isOnline(true)) {echo '</li>';}
}
echo '</ul>';
}
if ($lev1 -> isOnline(true)) {echo '</li>';}
}
echo '</ul>';
?>
Code: Alles auswählen
$PATH = explode("|", $this -> getValue("path") . $this -> getValue("article_id") . "|");
echo '<ul class="nav navbar-nav rechtsbuendig">';
foreach (rex_category::getRootCategories() as $lev1)
Kann ich das irgendwie lösen?
Bedingung ist halt, dass ich diese Navigation verwende da ich die ganzen Bootstrap Klassen eingebaut habe.
Vielen Dank für eure Vorschläge!