Instantly share code, notes, and snippets.
Fully cached menu with TypoScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page.10 > | |
page.10 = COA | |
page.10 { | |
cache { | |
key = main-menu | |
} | |
10 = TEXT | |
10 { | |
data = date : U | |
strftime = %H:%M:%S | |
noTrimWrap = |Time: | | | |
} | |
20 = HMENU | |
20 { | |
special = directory | |
special.value = 2 | |
wrap = <div class"menu">|</div> | |
1 = TMENU | |
1.expAll = 1 | |
1.wrap = <ul>|</ul> | |
1 { | |
NO = 1 | |
NO.wrapItemAndSub = <li>|</li> | |
} | |
2 < .1 | |
3 < .1 | |
4 < .1 | |
} | |
} | |
# replaces the A tag of the active menu item | |
page.stdWrap.replacement.10 { | |
search.cObject = HMENU | |
search.cObject { | |
special = list | |
special.value.field = uid | |
# take care to copy any additional params to the A tag | |
1 = TMENU | |
1 { | |
NO = 1 | |
} | |
} | |
replace.cObject = HMENU | |
replace.cObject { | |
special = list | |
special.value.field = uid | |
# take care to copy any additional params to the A tag | |
1 = TMENU | |
1 { | |
NO = 1 | |
NO.ATagParams = class="active" | |
} | |
} | |
} | |
/* | |
debug here | |
page.20 > | |
page.20 < page.stdWrap.replacement.10.search.cObject | |
page.30 > | |
page.30 < page.stdWrap.replacement.10.replace.cObject | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment