TYPO3: XHTML Valid 3 Level Menu in Typoscript
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: Setting XHTML 1.1 DOCTYPE
- TYPO3: Copyright Notice with Automatic Year Update and Secondary Language Support
- TYPO3: Add tt_news LATEST as TypoScript Object
- TYPO3: tt_news LIST and SINGLE at the same page
typo3 wrapitemandsub • typo3 menu nolink • typo3 menu donotlinkit specific page or id • typo3 menu donotlinkit • ul inside li • typo3 menu example • typoscript gp data • typo3 menu blur • tmenu donotlink • levelcurrent page typo3 • third level menu typo3 • typoscript text vlaue data • menu typoscript • div expand collapse on plus minus sign • hmenu atagparams • nested menu typoscript • typo3 linkwrap to button • submenu typo3 active • how to wrap span tag using a tag in hmenu tmenu • expand collapse plus minus • tmenu example • typo3 no blur menu link • typo3 atagparams • typoscript page level • typo3 wrap only menu items with submenu • f • ul li collapsing menu freeware • typo3 linkwrap • typo3 menu expand all • hmenu expand all • typoscript menu • typo3 do not link ifsub • typo3 menu ifsub donotlinkit • typo3 donotlink ifsub menu • typoscript tmenu wrap |*| ul • • donotlink typo3 • typo3 noblur • tmenu first item • typoscript tmenu collapse • hmenu subpages • ul within an li • typo3 hmenu submenus nested • typo3 get typoscript username • typo3 typoscript for tmenu • hmenu rootline manual • typo3 cur • typoscript getpage • second level menu typo3 • wrap menu typo3 • typoscript tmenu if • typo3 tmenu atagparam class • typoscript has submenu • typo3 atag • typo3 submenu jquery • typo3 [pidupinrootline • typo3 donotlinkit • hmenu ifempty • typo3 actifsub • typo3 hmenu expand • typo3 wrapitemandsub • typo3 menu nolink • typo3 menu donotlinkit specific page or id • typo3 menu donotlinkit • ul inside li • typo3 menu example • typoscript gp data • typo3 menu blur • tmenu donotlink • levelcurrent page typo3 • third level menu typo3 • typoscript text vlaue data • menu typoscript • div expand collapse on plus minus sign • hmenu atagparams • nested menu typoscript • typo3 linkwrap to button • submenu typo3 active • how to wrap span tag using a tag in hmenu tmenu • expand collapse plus minus • (15.209 ms)






about 1 year ago
Hi Klaus
Is it possible to have an ACT and a NO state to the title of the parent page?
about 9 months ago
How is this menu look like???? is there any shau?
about 5 months ago
Hi Klaus,
that’s a mighty helpful snippet – is there any chance you could include the HTML output, too?
about 2 months ago
Seems that the section
10.1.NO {
wrapItemAndSub = |
}
is missing the closing
Thanks — Tony