Skip to content

Instantly share code, notes, and snippets.

@kraftb
Created October 31, 2013 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kraftb/7246693 to your computer and use it in GitHub Desktop.
Save kraftb/7246693 to your computer and use it in GitHub Desktop.
HOWTO: Use Fluid templates sharing a layout but use different content areas
TITLE: Classical TYPO3 advanced fluid templating
TAGS: TYPO3 FLUIDTEMPLATE templating cObject
template-start.html and template-page.html should get referenced from within the FLUIDTEMPLATE content object.
start.html and page.html are the files supplied by your designer.
It goes to and fro from template-start.html to start.html
Probably Neos is called "N"eos because of this fact.
-------------- template-start.html / BEGIN --------------------
<f:layout name="start.html" /> <!-- Of course you have to remove the ".html" from start.html it's just here to denote that "start.html" will get used -->
<f:section name="content">
<f:render partial="start.html" section="start-content"> <!-- Of course you have to remove the ".html" from start.html it's just here to denote that "start.html" will get used -->
</f:section>
-------------- template-start.html / END --------------------
-------------- template-page.html / BEGIN --------------------
<f:layout name="start.html" /> <!-- Of course you have to remove the ".html" from start.html it's just here to denote that "start.html" will get used -->
<f:section name="content">
<f:render partial="page.html" section="page-content"> <!-- Of course you have to remove the ".html" from page.html it's just here to denote that "page.html" will get used -->
</f:section>
-------------- template-page.html / END --------------------
-------------- start.html / BEGIN --------------------
<!DOCTYPE html>
<html>
<f:section name="DOCUMENT_HEAD">
<!-- The f:section will not get rendered if not called by an f:render statement -->
<head>...</head>
</f:section>
<body>
<div id="header"> ... </div>
<f:render section="content" /> <!-- This will render the f:section=content of the original template file (template-start.html or template-page.html) which was referenced from the FLUIDTEMPLATE content object -->
<f:section name="start-content"> <!-- This section will simply be named "page-content" in the designers -->
<div id="content">
...
<f:section name="special-content-element">
<div class="some-content-element">
<h1> specially formatted</h1>
</div>
</f:section>
...
</div>
</f:section>
<div id="footer"> ... </div>
</body>
</html>
-------------- start.html / END --------------------
This can get used from within a FLUIDTEMPLATE to insert some special content element.
For example to insert this element on every page or by using the tscobj extension.
-------------- fluid-ce.html / BEGIN --------------------
<f:render partial="start.html" section="special-content-element" />
-------------- fluid-ce.html / END --------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment