Den aktiven Navigationspunkt bei TYPOlight verlinken

TYPOlight gibt bei Navigationelementen den aktiven Menüpunkt nicht als Link an. Dies hat vor und Nachteile. Möchte man dies jedoch gerne ändern, kann man wie folgt vorgehen und den aktiven Navigationspunkt wieder verlinken, ohne in den Corefiles rumfuschen zu müssen, bei denen Änderungen bei einem Update wieder verloren gehen.

Vorgehen

Um den aktiven Menüpunkt bei TYPOlight wieder zu verlinken, kopieren wir die Templatedatei "nav_default.tpl" aus dem Ordner "system/modules/frontend/templates/" und fügen diese in den Ordner "templates" ein. In der kopierten "nav_default.tpl" kann man dann anstatt des span-Elementes den entsprechenden Link einfügen. Hier sollte nur tunlichst darauf geachtet werden, dass die TYPOlight Syntax beibehalten wird, damit alle Funktionen erhalten bleiben. TYPOlight nutzt nun die Templatedatei aus dem Ordner templates im Rootverzeichnis der TYPOlight-Installatiton um das Menü zu generieren.

Codebeispiel (TYPOlight 2.7.2)

nav_default.tpl

<ul class="<?php echo $this->level; ?>">
<?php foreach ($this->items as $item): ?>
<?php if ($item['isActive']): ?>
<li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>" class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?></a><?php echo $item['subitems']; ?></li>
<?php else: ?>
<li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?><?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?><?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?><?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>"><?php echo $item['link']; ?></a><?php echo $item['subitems']; ?></li>
<?php endif; ?>
<?php endforeach; ?>

Tags:

Well, it looks very nice php code, I want to try it. But language problem. I tried to understand this post here on this site with the help of google translator but I could not understand properly how all this works. Anyway I think it is a very good plateform for professionals. If I have complete information, I think I can do something here like I am doing on my own project pdf books. Thanks for all this work. Very good work! I always like to leave comments whenever I see something unusual or impressive. I think we must appreciate those who do something especial. Keep it up.

David Mayer
geo tv live

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <i>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

CAPTCHA
Diese Frage ist um sicher zu stellen, dass es sich um einen Menschen und nicht einen Computer handelt. Dies ist zur Spamabwehr notwendig.
19 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.