Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save muex/50105f628b8f0ea20cd53519c6bd984f to your computer and use it in GitHub Desktop.
Save muex/50105f628b8f0ea20cd53519c6bd984f to your computer and use it in GitHub Desktop.
Just a little code snippet to help you building a one pager website with TYPO3 CMS
// The one pager navigation
// You can choose any field from the page record with "{field:fieldname}"
// But I would recommend the field "alias" since it makes sense the most for navigation
lib.onepageMenu = HMENU
lib.onepageMenu{
special = directory
special.value = 44
1 = TMENU
1{
wrap = <nav class="navbar"><ul class="nav navbar-nav"> | </ul></nav>
NO{
doNotLinkIt = 1
wrapItemAndSub = <li class="nav-item"><a class="nav-item" href="#{field:alias}">|</a></li>
wrapItemAndSub.insertData = 1
}
}
}
// We are using a menu to get the content related to the subpages of the root page
lib.onepageContent = HMENU
lib.onepageContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
where = (tx_gridelements_container = 0) # Very important to NOT show contents 2 times when you use Gridelemenents
}
wrap = <div class="container" id="{field:alias}">|</div>
wrap.insertData = 1
renderObj < tt_content
}
}
}
}
}
}
// Finally add the content to your fluid template through a variable
page{
10 = FLUIDTEMPLATE
10{
variables {
contentMain < lib.onepageContent
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment