TYPO3: Making a simple menu as an unordered list in XHTML

This example how to make a menu as an unordered list, by enabling ACT (active) and CUR (current) it sets the <li> tags with attributes class=”active” and id=”current” respectively. The current page is wrapped in <span> and not linked.


## MainMenu [Begin]
lib.mainMenu = HMENU
lib.mainMenu.entryLevel = 0
lib.mainMenu.wrap =

    |

lib.mainMenu.1 = TMENU
lib.mainMenu.1 {
noBlur = 1
ACT = 1
CUR = 1
}
lib.mainMenu.1.NO {
allWrap =

  • |
  • }
    lib.mainMenu.1.ACT {
    allWrap =

  • |
  • }
    lib.mainMenu.1.CUR {
    allWrap =

  • |
  • doNotLinkIt = 1
    }
    ## MainMenu [End]

    The above example can be extended using field:title and field:subtitle, if a specific id for styling is needed or if some information should be placed as value in the title attribute.


    lib.mainMenu.1.NO {
    allWrap =

  • |
  • ATagParams.dataWrap = id="{field:title}" title="{field:subtitle}"
    }
    lib.mainMenu.1.ACT {
    allWrap =

  • |
  • ATagParams.dataWrap = id="{field:title}" title="{field:subtitle}"
    }

    This entry was posted in TYPO3/TypoScript. Bookmark the permalink.

    3 Responses to TYPO3: Making a simple menu as an unordered list in XHTML

    1. okapi says:

      Thank you a lot, that helped me to solve a problem that i had with a menu i was working on!

      Michael

    2. Thanks so much, this solution worked right out of the box for me. I do wonder if it’s required to first use a hierarchiel menu(HMENU) for the root element and a text menu(TMENU) inside.
      The corresponding CSS should be a breeze now!

    3. I was curious if there was a way to apply the id={field:title} to the (li) tag instead of the (a) tag?

    Leave a Reply