+ Antworten
Ergebnis 1 bis 2 von 2

Thema: Navbar - Title attribut nicht mit [[NAME]] befüllen

  1. #1
    Registriert seit
    05.01.2009
    Beiträge
    5

    Frage Navbar - Title attribut nicht mit [[NAME]] befüllen

    Hallo zusammen,

    ich hätte die Anforderung, dass ich einen alternativen Text anstatt des einfachen Link Namens im title attribut in der navbar.html angeben kann, damit ich beim drüberfahren mit der Maus mehr Information zu dem entsprechenden Link in meiner Navigation erhalte.

    Gibt es einen Platzhalter, der zum den Wert aus dem Meta Seitentitel anzeigt?

    zum Beispiel in der Art:
    <!-- BEGIN level_1 --><li><a href="[[URL]]" class="[[STYLE]]" title="[[METATITLE]]" target="[[TARGET]]">[[NAME]]</a></li><!-- END level_1 -->

    Freue mich auf Antworten und Ideen,
    Dirk

  2. #2
    Registriert seit
    14.08.2008
    Ort
    Niederrhein
    Beiträge
    1.185

    Standard

    Hallo dkopp,

    für dein Vorhaben musst du ein wenig die Datei /core/navigation.class.php bearbeiten (vorher eine Sicherung des Originals anlegen).

    Zunächst muss der Seitentitel oder Metatitel (je nach Belieben) aus der DB mit ausgelesen werden.
    ~ Zeile 91 (Auszug aus der query)
    Code:
            $query = "SELECT n.cmd,
                             n.catid,
                             n.catname,
                             n.target,
                             n.parcat,
                             n.css_name,
                             n.displaystatus,
                             c.metatitle AS mtitle,
                             c.redirect,
                             m.name AS section,
                             a_s.url AS alias_url
                        FROM ".DBPREFIX."content_navigation     AS n
                  INNER JOIN ".DBPREFIX."content                AS c    ON c.id = n.catid
    (title = Seitentitel, metatitle = meta Seitentitel)

    Als nächstes werden die Werte zu den anderen in ein Array geschrieben.
    ~ Zeile 176
    Code:
                    $this->data[$objResult->fields['catid']]= array(
                        'catid'    => $objResult->fields['catid'],
                        'url'      => $menu_url,
                        'catname'  => stripslashes($objResult->fields['catname']),
                        'target'   => $objResult->fields['target'],
                        'mtitle'  => $objResult->fields['mtitle'],
                        'css_name' => $objResult->fields['css_name'],
                        'status' => $objResult->fields['displaystatus']
                    );
    Für die drei grundsätzlichen Formen des Menüs (navigation, nested_navigation, navigation_dropdown) muss jetzt noch der Platzhalter definiert werden.
    ~ Zeile 350
    Code:
                    if(isset($topLevelBlockName)){
                        if(!$hideLevel){
                            // checks if we are in the active tree
                            $activeTree = (in_array($id, $this->parents)) ? true : false;
                            if ($this->data[$id]['status'] == 'on') {
                                // gets the style sheets value for active or inactive
                                $style = ($activeTree) ? $this->styleNameActive : $this->styleNameNormal;
                                // get information about the next level id -> down or empty
                                // $levelInfo = (($level > $nextlevel) OR $activeTree AND $id <> $this->pageId) ? $this->levelInfo : "";
    
                                $levelInfo = ($level > $nextlevel) ? $this->levelInfo : "";
                                $target = empty($this->data[$id]['target']) ? "_self" : $this->data[$id]['target'];
    
                                $this->_objTpl->setCurrentBlock($blockName);
                                $this->_objTpl->setVariable('URL',$this->data[$id]['url']);
                                $this->_objTpl->setVariable('NAME',htmlentities($this->data[$id]['catname'], ENT_QUOTES, CONTREXX_CHARSET));
                                $this->_objTpl->setVariable('TARGET',$target);
                                $this->_objTpl->setVariable('MTITLE',htmlentities($this->data[$id]['mtitle'], ENT_QUOTES, CONTREXX_CHARSET));
                                $this->_objTpl->setVariable('LEVEL_INFO',$levelInfo);
                                $this->_objTpl->setVariable('NAVIGATION_ID',$navigationId[$level]);
                                $this->_objTpl->setVariable('STYLE',$style);
                                $this->_objTpl->setVariable('CSS_NAME',$this->data[$id]['css_name']);
                                $this->_objTpl->parse($blockName);
                                $htmlOutput.=$this->_objTpl->get($blockName, true);
                            }
                        }
                    }
    ~ Zeile 469
    Code:
                // Checks if this is an active menu item
                $style = (in_array($id, $this->parents)) ? $this->styleNameActive : $this->styleNameNormal;
    
                $target = empty($this->data[$id]['target']) ? "_self" : $this->data[$id]['target'];
    
                $tmpNavigationBlock = str_replace('{NAME}', $this->data[$id]['catname'], $nestedRow);
                $tmpNavigationBlock = str_replace('<li>', '<li class="'.$style.'">', $tmpNavigationBlock);
                $tmpNavigationBlock = str_replace('{URL}', $this->data[$id]['url'], $tmpNavigationBlock);
                $tmpNavigationBlock = str_replace('{TARGET}', $target, $tmpNavigationBlock);
                $tmpNavigationBlock = str_replace('{MTITLE}', $this->data[$id]['mtitle'], $tmpNavigationBlock);
                $tmpNavigationBlock = str_replace('{CSS_NAME}',  $this->data[$id]['css_name'], $tmpNavigationBlock);
                $tmpNavigationBlock = str_replace('{NAVIGATION_ID}', $navigationId[$level], $tmpNavigationBlock);
    
                $navigationBlock .= $tmpNavigationBlock."\n";
    ~ Zeile 552
    Code:
                        $tmpNavigation = str_replace('{URL}', $this->data[$id]['url'], $tmpNavigation);
                        $tmpNavigation = str_replace('{NAME}', $this->data[$id]['catname'], $tmpNavigation);
                        $tmpNavigation = str_replace('{TARGET}', $target, $tmpNavigation);
                        $tmpNavigation = str_replace('{MTITLE}', $this->data[$id]['mtitle'], $tmpNavigation);
                        $tmpNavigation = str_replace('{NAVIGATION_ID}', $navigationId[$level], $tmpNavigation);
                        $tmpNavigation = str_replace('{SUB_MENU}', $subNavigation, $tmpNavigation);
                        $tmpNavigation = str_replace('{CSS_NAME}', $this->data[$id]['css_name'], $tmpNavigation);
    
                        $navigation .= $tmpNavigation;
    Mit diesen Änderungen sollte es dir nun möglich sein, in der Navigation diesen Platzhalter [[MTITLE]] zu verwenden.
    denken erfordert die aktive Verwendung des Gehirns
    http://www.unser-zoohause.de || Tipp: Debuggen von Designs, Anleitung Themes

+ Antworten

Stichworte

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein