[TYPO3] Giving the first and last items in a menu an extra class

Stephen Bungert s.bungert at metrinomics.de
Tue Dec 18 17:41:24 CET 2007


A piece of my current code:

lib.mainNav.1 {
  
  # Normal state properties
  NO.stdWrap.htmlSpecialChars = 1
  
  # Allow adding the Uid to wrap HTML
  NO.subst_elementUid = 1
  NO.ATagBeforeWrap = 1
  NO.allWrap = <li class="menuMain-no" id="mainMenuLi{elementUid}"> | </li>
  NO.ATagParams = id="mainMenuLiA{elementUid}"

  
  # Enable active state and set properties:
  ACT = 1
  ACT.stdWrap.htmlSpecialChars = 1
  ACT.allWrap = <li class="menuMain-act" id="mainMenuLi{elementUid}"> |
</li>
  
  # Remove link form active menu items
  CUR = 1
  CUR.stdWrap.htmlSpecialChars = 1
  CUR.doNotLinkIt = 1
  CUR.allWrap = <li class="menuMain-cur" id="mainMenuLi{elementUid}"> | </li

}

Is it possible tot o make the first item and last item in a menu have a
different class? I need the first item to have the class 'first' and the
last item 'last'.

Hi do this with typoscript? Conditions based on id number? I'd rather have
something that works automatically incase pages are added later. I thought
maybe using optionSplit, there's even an example in tsrf for menus, but this
is only for submenus. How can you do this on a top level menu?



More information about the TYPO3-english mailing list