Skip to content

Instantly share code, notes, and snippets.

@beardcoder
Forked from pgampe/menu.ts
Created March 31, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beardcoder/ef1588473a2258f50f44fe45fe5f6644 to your computer and use it in GitHub Desktop.
Save beardcoder/ef1588473a2258f50f44fe45fe5f6644 to your computer and use it in GitHub Desktop.
Fully cached menu with TypoScript
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