Skip to content

Instantly share code, notes, and snippets.

@hlubek
Created December 19, 2014 08:51
Show Gist options
  • Select an option

  • Save hlubek/8f0caee69a837d17f8c1 to your computer and use it in GitHub Desktop.

Select an option

Save hlubek/8f0caee69a837d17f8c1 to your computer and use it in GitHub Desktop.
Reusing Fluid templates with sections in Neos
<div>
<h1>List of something</h1>
...
<ul>
<!-- This will not be rendered by default -->
<f:section name="item">
<li>
{itemNode.properties.title}
</li>
</f:section>
<!-- We could as well use a Collection TS object instead of a Fluid f:for -->
<f:for each="{items}" as="itemNode">
<ts:render path="itemRenderer" context="{itemNode: itemNode}" />
</f:for>
</ul>
</div>
// Rendering sections can also simplify node types that render collections of something to have everything in one template
prototype(My.Site:List.Something) {
# Auto-generated value
# templatePath = 'resource://My.Site/Private/Templates/NodeTypes/List.Something.html'
items = ${...some FlowQuery...}
itemRenderer = TYPO3.TypoScript:Template {
templatePath = 'resource://My.Site/Private/Templates/NodeTypes/List.Something.html'
sectionName = 'item'
}
}
// Rendering sections is useful for using separate sections for a page template and have that in a single file
page {
head {
stylesheets {
main = TYPO3.TypoScript:Template {
templatePath = 'resource://My.Site/Private/Templates/Page/Default.html'
sectionName = 'stylesheets'
}
}
}
body {
templatePath = 'resource://My.Site/Private/Templates/Page/Default.html'
sectionName = 'body'
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment