This is sort of a long snippet, but anyway it is an example of making a vertical 3 level menu, which expand and collapse according to the active and current chosen list-item / page. The menu made as nested unordered list, and further it is wrapped in a box made of divs, where the title of active parent page to the menu is shown. The pattern of the typoscript menu could be repeated, if a fourth level is wanted, and it could be shortened to a 1 or 2 level menu.
- ## SubMenu [Begin]
- # Removes the menubox from the page ids: 19, 23 (if the page does not have subpages, you don’t want an empty box)
- # do nothing (PIDupinRootline doesn’t seem to work?)
- [else]
- boxtop = TEXT
- # get the title of the page on the first level of the rootline.
- boxtop.data = leveltitle:1
- boxtop.wrap = <div class="columnbox"><div class="columnbox-top">|</div><div class="columnbox-content">
- boxbottom = TEXT
- boxbottom.value = </div><div class="columnbox-bottom"></div></div>
- [end]
- lib.subMenu {
- # include top of columnbox
- 9 < boxtop
- # making the menu
- 10 = HMENU
- # defines the menu entrylevel
- 10.entryLevel = 1
- 10.1 {
- noBlur = 1
- CUR = 1
- IFSUB= 1
- }
- # Formatting of menu normal entries as list items.
- wrapItemAndSub = <li class="normal minus">|
- }
- # Current menu item is unlinked and wrapped in span
- wrapItemAndSub = <li id="current" class="minus">|</li>
- doNotLinkIt = 1
- allWrap = <span>|</span>
- }
- # If the menu item has subs add class plus to change icon to it has subs
- wrapItemAndSub = <li class="normal plus">|</li>
- }
- # Active items above current to be formatted differently
- wrapItemAndSub = <li class="active minus">|</li>
- }
- # Wrap the first level of the menu inside an unordered list
- 10.1.wrap = <ul class="cb-menu">|</ul>
- 10.2 {
- noBlur = 1
- CUR = 1
- IFSUB= 1
- }
- # Same formatting of menu entries as list items.
- wrapItemAndSub = <li class="normal minus">|</li>
- ATagParams =
- }
- # Current menu item is unlinked and marked too
- wrapItemAndSub = <li id="current" class="minus">|</li>
- doNotLinkIt = 1
- allWrap = <span>|</span>
- }
- # If the menu item has subs add class plus to change icon
- wrapItemAndSub = <li class="normal plus">|</li>
- }
- # Active items above current to be formatted differently as for first level
- wrapItemAndSub = <li class="active minus">|</li>
- }
- # Wrap the second level of the menu inside an unordered list
- 10.2.wrap = <ul class="cb-submenu">|</ul>
- 10.3 {
- noBlur = 1
- CUR = 1
- IFSUB = 1
- }
- # Same formatting of menu entries as list items.
- wrapItemAndSub = <li class="normal minus">|</li>
- ATagParams =
- }
- # Current menu item is unlinked and marked too
- wrapItemAndSub = <li id="current" class="minus">|</li>
- doNotLinkIt = 1
- allWrap = <span>|</span>
- }
- # If the menu item has subs add class plus to change icon
- wrapItemAndSub = <li class="normal plus">|</li>
- }
- # Active items above current to be formatted differently as for higher levels
- wrapItemAndSub = <li class="active minus">|</li>
- }
- # Wrap the third level of the menu inside an unordered list
- 10.3.wrap = <ul class="cb-subsubmenu">|</ul>
- # end of columnbox
- 11 < boxbottom
- }
- ## SubMenu [End]
Related Articles:
- TYPO3: Making a simple menu as an unordered list in XHTML
- TYPO3: How to make a path/breadcrumb in typoscript
- TYPO3/TypoScript: How to add Page Updated Timestamp
- TYPO3: Copyright Notice with Automatic Year Update and Secondary Language Support
- TYPO3: Setting XHTML 1.1 DOCTYPE
- TYPO3: Add tt_news LATEST as TypoScript Object
- TYPO3: tt_news LIST and SINGLE at the same page
- TYPO3: Changing the tt_news template markup
Hi Klaus
Is it possible to have an ACT and a NO state to the title of the parent page?
How is this menu look like???? is there any shau?
Hi Klaus,
that’s a mighty helpful snippet – is there any chance you could include the HTML output, too?
Seems that the section
10.1.NO {
wrapItemAndSub = |
}
is missing the closing
Thanks — Tony