[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 213: Undefined array key "FORUM_NAME"
REDAXO Forum • R 4.6.1 Breadcrumb Wurzel category abweichend von 0
Seite 1 von 1

R 4.6.1 Breadcrumb Wurzel category abweichend von 0

Verfasst: 6. Feb 2015, 21:32
von dezibel
Hallo zusammen!

Die Breadcrumb soll ab $category_id = 10 angezeigt werden. Angezeigt wird jedoch der komplette Pfad - so als würde category_id = 0 der Funktion übergeben werden.

Code: Alles auswählen

$nav->getBreadcrumb(TRUE, TRUE, 10);
Hingegen wird das Navigationsmenü korrekt ab Wurzelkategorie mit der category_id = 10 angezeigt.

Code: Alles auswählen

$category_id = 10;
$depth = 3;
$open = TRUE;
$ignore_offlines = TRUE;

$navigation = $nav->get($category_id, $depth, $open, $ignore_offlines);
Hier noch einmal die function getBreadcrumb(...);
An welcher Stelle in der function wird eigentlich der Parameter $category_id verarbeitet?
Habe ich etwas übersehen?

Code: Alles auswählen

function getBreadcrumb($startPageLabel, $includeCurrent = false, $category_id = 0)
    {                                                                             
        if (!$this->_setActivePath()) {
            return false;
        }

        global $REX;

        $path = $this->path;

        $i = 1;
        $lis = '';

        if ($startPageLabel) {
            $lis .= '<li class="rex-lvl' . $i . '"><a href="' . rex_getUrl($REX['START_ARTICLE_ID']) . '">' . htmlspecialchars($startPageLabel) . '</a></li>';
            $i++;

            // StartArticle nicht doppelt anzeigen
            if (isset($path[0]) && $path[0] == $REX['START_ARTICLE_ID']) {
                unset($path[0]);
            }
        }

        foreach ($path as $pathItem) {
            $cat = OOCategory::getCategoryById($pathItem);
            $lis .= '<li class="rex-lvl' . $i . '"><a href="' . $cat->getUrl() . '">' . htmlspecialchars($cat->getName()) . '</a></li>';
            $i++;
        }

        if ($includeCurrent) {
            if ($art = OOArticle::getArticleById($this->current_article_id)) {
                if (!$art->isStartpage()) {
                    $lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($art->getName()) . '</li>';
                } else {
                    $cat = OOCategory::getCategoryById($this->current_article_id);
                    $lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($cat->getName()) . '</li>';
                }
            }
        }

        return '<ul class="rex-breadcrumb">' . $lis . '</ul>';
    }
Ich bedanke mich für einen guten Tip!