Forked from koehlersimon/Create a One Pager with TYPO3 and TypoScript
Created
August 22, 2018 20:41
-
-
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
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
// 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