Zum Inhalt springen

externe Url im Menü direkt verlinken

Erstellt am 17. März 2011 · 1 Antwort · letzte Antwort am 17. März 2011

Tags: Frage

Steppo ·

Moin zusammen,

ich habe hier folgenden Snippet gefunden http://www.typo3wizard.com/de/snippets/menus/externe-links-und-shortcuts-direkt-im-menue.html.

Externe Links und Shortcuts direkt im Menü

Soweit passt das auch, nun würde ich das aber gerne auf mein gesamtes Menü anwenden.

temp.top_navigation = HMENU
temp.top_navigation {
  special = directory
  special.value = {$top}  
  1=TMENU
  1.wrap=<ul id="nav">|</ul>
  1.NO {
    # hier nicht verlinken, ansonsten bekommt man doppelte <a> tags
    doNotLinkIt = 1
    wrapItemAndSub=<li>|</li>
    stdWrap.cObject = CASE
    stdWrap.cObject {
      key.field = doktype
      default = TEXT
      default {
        typolink.parameter.field = uid
        field = title
        stdWrap.htmlSpecialChars = 1
      }
      			# 4 = shortcut
      4 = TEXT
      4 {
        field = title
        typolink.parameter.field = shortcut
      }
      			# 3 = external url
      3 = TEXT
      3 {
        field = title
        typolink.parameter.field = url
        typolink.extTarget.field = target
      }
       
    }
  }
  2 < .1
  
  3 < .1
  4 < .1
}

Nun habe ich aber das Problem, dass das jeweilige Untermenü erst angezeigt wird, wenn es aktiv ist und irgendwie stehe ich gerade auf dem Schlauch.

Vielleicht hat ja jemand einen Tipp für mich.

Danke schonmal!

Steppo ·

habe nun eine erweiterte Lösung gefunden.
Quelle: http://lists.typo3.org/pipermail/typo3-english/2007-February/036556.html

Hier der Code

temp.tmenu= HMENU
temp.tmenu.wrap = <div class="example">|</div>
temp.tmenu{
    # erstes level
  1 = TMENU
  1.wrap = <ul class="adxm menu">|</ul>
  1{
          # no state: normale Formatierung
    expAll = 1
    NO{
      wrapItemAndSub = <li>|</li>
##################################################
# start of mods for direct link
##################################################doNotLinkIt = 1
stdWrap.cObject = CASE
    stdWrap.cObject {
      key.field = doktype
      default = TEXT
      default {
        field = title
        stdWrap.htmlSpecialChars = 1
      }
                        # 4 = shortcut
      4 = TEXT
      4 {
        field = title
        typolink.parameter.field = shortcut
                                        #remove the link here because its generated by the above typoscript
        doNotLinkIt = 1
      }
                        # 3 = external url
      3 = TEXT
      3 {
        field = title
        typolink.parameter.field = url
        typolink.extTarget.field = target
                                        #remove the link here because its generated by the above typoscript                             doNotLinkIt = 1
      }

    }

######################################################
# end of mods for direct link
######################################################


      }
                # act state: gültig von der rootseite bis zur aktuellen Seite
    ACT=1
    ACT{
      wrapItemAndSub = <li class="menu-level1-active">|</li>
    }
                # cur state: gültig für die aktuelle Seite
    CUR=1
    CUR{
      wrapItemAndSub = <li class="menu-level1-current-active">|</li>
    }
                # ifsub state: gültig für seiten die unterseiten haben
    IFSUB=1
    IFSUB{
      wrapItemAndSub = <li class="menu-level1-with-subpage">|</li>
    }
  }
        # zweites level
  2 = TMENU
  2.wrap = <ul class="menu-level2">|</ul>
  2{
    NO{
      wrapItemAndSub = <li>|</li>
    }
    ACT=1
    ACT{
      wrapItemAndSub = <li class="menu-level2-active">|</li>
    }
    CUR=1
    CUR{
      wrapItemAndSub = <li class="menu-level2-current-active">|</li>
    }
    IFSUB=1
    IFSUB{
      wrapItemAndSub = <li class="menu-level2-with-subpage">|</li>
    }
  }
        # drittes level
  3 = TMENU
  3.wrap = <ul class="menu-level3">|</ul>
  3{
    NO{
      wrapItemAndSub = <li>|</li>
    }
    ACT=1
    ACT{
      wrapItemAndSub = <li class="menu-level3-active">|</li>
    }
    CUR=1
    CUR{
      wrapItemAndSub = <li class="menu-level3-current-active">|</li>
    }
    IFSUB=1
    IFSUB{
      wrapItemAndSub = <li class="menu-level3-with-subpage">|</li>
    }
  }
}

Bis denne..