问题
I want to change the wrap
of a TMENU
if the current active menu item has a submenu (ACTIFSUB
).
Below is a excerpt of my typoscript:
lib.navigation = HMENU
lib.navigation {
1 = TMENU
1 {
wrap = <ul class="m-navigation-list">|</ul>
# if the current active menu item has a submenu, change the wrap to this:
# wrap = <ul class="m-navigation-list m-navigation-list--parent">|</ul>
ACTIFSUB = 1
ACTIFSUB {
wrapItemAndSub = <li class="m-navigation-item m-navigation-link--parent m-navigation-link--ladder">|</li>
# overwrite the wrap of the TMENU?
}
}
回答1:
Be careful as if you enable expAll, submenus will be always printed and as consequence override will be always used.
Here is working example:
lib.navigation = HMENU
lib.navigation {
wrap = <ul>|</ul>
wrap.override = <ul class="override">|</ul>
entryLevel = 0
1 = TMENU
1 {
expAll = 0
NO.allWrap = <li> | </li>
ACT = 1
ACT.allWrap = <li>|</li>
ACTIFSUB = 1
ACTIFSUB {
allWrap= <li class="sub">|</li>
before.cObject = LOAD_REGISTER
before.cObject.actsubmenu = TEXT
before.cObject.actsubmenu.value = 1
}
}
wrap.override.if.isTrue.data = REGISTER:actsubmenu
}
来源:https://stackoverflow.com/questions/26061249/change-wrap-of-tmenu-when-active-menu-item-has-a-submenu