can someone explain to me, why this TypoScript doesn't work in version 12.4 anymore. I am updating from 7.6 and thought treeLevel -> tree.level was the only change in this regard.
here is my code:
lib._submenu = HMENU
lib._submenu {
1 = TMENU
1 {
expAll = 1
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB.wrapItemAndSub = <li class="hasSub">|</li>
ACT < .NO
ACT = 1
ACT.wrapItemAndSub = <li class="active">|</li>
ACT.ATagParams = class="active"
ACTIFSUB = 1
ACTIFSUB.wrapItemAndSub = <li class="hasSub active">|</li>
ACTIFSUB.ATagParams = class="active"
SPC = 1
SPC.wrapItemAndSub = <li class="trenner">|</li>
SPC.doNotShowLink = 0
}
stdWrap.ifEmpty.cObject = HMENU
stdWrap.ifEmpty.cObject {
1 = TMENU
1 {
expAll = 1
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB.wrapItemAndSub = <li class="hasSub">|</li>
ACT < .NO
ACT = 1
ACT.wrapItemAndSub = <li class="active">|</li>
ACT.ATagParams = class="active"
ACTIFSUB = 1
ACTIFSUB.wrapItemAndSub = <li class="hasSub active">|</li>
ACTIFSUB.ATagParams = class="active"
SPC = 1
SPC.wrapItemAndSub = <li class="trenner">|</li>
SPC.doNotShowLink = 0
}
}
}
[tree.level == 1]
lib._submenu {
entryLevel = 1
}
[END]
[tree.level == 2]
lib._submenu {
entryLevel = 2
stdWrap.ifEmpty.cObject = HMENU
stdWrap.ifEmpty.cObject {
entryLevel = 1
}
}
[END]
[tree.level == 3]
lib._submenu {
entryLevel = 3
stdWrap.ifEmpty.cObject = HMENU
stdWrap.ifEmpty.cObject {
entryLevel = 2
}
}
[END]
[tree.level == 4]
lib._submenu {
entryLevel = 4
stdWrap.ifEmpty.cObject = HMENU
stdWrap.ifEmpty.cObject {
entryLevel = 3
}
}
[END]
I have been searching for a solution the past week, but it seems noone ever did a menu like that. It should show the pages of the current level, but when there are none it should display the items of the previous level.
Entry level is not about the level the menu actually starts with, but about the level at which that menu becomes visible. So even with former versions of TYPO3 CMS the code should not work as expected.
https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Hmenu/Index.html#entrylevel
What you actually want seems to be something like this:
The good thing about this approach is, that you don not need any conditions and therefore you reduce the amount of cached variants which is good for performance.