Wie kann ich im Redaxo CMS den Pfad für den User ausgeben?
Also nach dem Stil: "Sie befinden sich in STARTSEITE - Kontakt"?
MfG
Ronny-Heiko
<?php
// EXPLODE PATH
$PATH = explode("-",$this->getValue("path"));
// GET CURRENTS
if(count($PATH)==1) {
$MAIN = $PATH[0];
}
else {
$MAIN = $PATH[1];
$SUB01 = $PATH[2];
$SUB02 = $PATH[3];
}
$sitePath = "";
foreach (OOCategory::getRootCategories() as $LEVEL00) {
if ($LEVEL00->getId() == $MAIN) {
$sitePath .= '<a href="'.$LEVEL00->getUrl().'">'.$LEVEL00->getName().'</a>';
foreach ($LEVEL00->getChildren() as $LEVEL01 ):
if ($LEVEL01->getId() == $SUB01 )
$sitePath .= ' <a href="'.$LEVEL01->getUrl().'">'.$LEVEL01->getName().'</a>';
endforeach;
}
}
?>tbaddade hat geschrieben:ich mache es so:
- Code: Alles auswählen
<?php
// EXPLODE PATH
$PATH = explode("-",$this->getValue("path"));
// GET CURRENTS
if(count($PATH)==1) {
$MAIN = $PATH[0];
}
else {
$MAIN = $PATH[1];
$SUB01 = $PATH[2];
$SUB02 = $PATH[3];
}
$sitePath = "";
foreach (OOCategory::getRootCategories() as $LEVEL00) {
if ($LEVEL00->getId() == $MAIN) {
$sitePath .= '<a href="'.$LEVEL00->getUrl().'">'.$LEVEL00->getName().'</a>';
foreach ($LEVEL00->getChildren() as $LEVEL01 ):
if ($LEVEL01->getId() == $SUB01 )
$sitePath .= ' ›› <a href="'.$LEVEL01->getUrl().'">'.$LEVEL01->getName().'</a>';
endforeach;
}
}
?>
zu sehen unter http://karate-portal.com/index.php
gruss thomas
<div id="sitePath">Verlauf: <a href="/index.php">Startseite</a> <? echo $sitePath; ?></div><?php
// EXPLODE PATH
$PATH = explode("-",$this->getValue("path"));
// GET CURRENTS
if(count($PATH)==1) {
$MAIN = $PATH[0];
}
else {
$MAIN = $PATH[1];
$SUB01 = $PATH[2];
$SUB02 = $PATH[3];
}
$sitePath = "";
foreach (OOCategory::getRootCategories() as $LEVEL00) {
if ($LEVEL00->getId() == $MAIN) {
$sitePath .= '<a href="'.$LEVEL00->getUrl().'">'.$LEVEL00->getName().'</a>';
foreach ($LEVEL00->getChildren() as $LEVEL01 ):
if ($LEVEL01->getId() == $SUB01 )
$sitePath .= ' ›› <a href="'.$LEVEL01->getUrl().'">'.$LEVEL01->getName().'</a>';
foreach ($LEVEL01->getChildren() as $LEVEL02 ):
if ($LEVEL02->getId() == $SUB02 )
$sitePath .= ' ›› <a href="'.$LEVEL02->getUrl().'">'.$LEVEL02->getName().'</a>';
endforeach;
endforeach;
}
}
?><?php
// EXPLODE PATH
$PATH = explode("-",$this->getValue("path"));
// GET CURRENTS
if(count($PATH)==1) {
$MAIN = $PATH[0];
}
else {
$MAIN = $PATH[1];
$SUB01 = $PATH[2];
$SUB02 = $PATH[3];
}
$sitePath = "";
foreach (OOCategory::getRootCategories() as $LEVEL00) {
if ($LEVEL00->getId() == $MAIN) {
$sitePath .= '<a href="'.$LEVEL00->getUrl().'">'.$LEVEL00->getName().'</a>';
foreach ($LEVEL00->getChildren() as $LEVEL01 ):
if ($LEVEL01->getId() == $SUB01 )
$sitePath .= ' ›› <a href="'.$LEVEL01->getUrl().'">'.$LEVEL01->getName().'</a>';
endforeach;
}
}
// Wenn eine Unterseite gewählt wurde, die nicht die Startseite ist,
// dann SitePath um diese Seite erweitern
// Artikel-Objekt
$artid = OOArticle::getArticleById ($_GET['article_id']);
// Kategorie des gewählten Artikels ermitteln
$kategorie_id = $artid->getCategory ();
// Startartikel dieser Kategorie ermitteln (=Objekt)
$startartikel = $kategorie_id->getStartArticle();
// ID des Startartikels ermitteln
$startartikel_id = $startartikel->getID();
// Wenn der ausgewählte Artikel nicht der Startartikel ist, dann Link anzeigen
if ($_GET['article_id'] !=$startartikel_id) {
$sitePath .= ' ›› <a href="'.$artid->getUrl ().'">'.$artid->getName().'</a>';
}
?>
<?php include $REX[INCLUDE_PATH]."/generated/templates/2.template"; ?>Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste