[FLOW3-general] Fluid Templates in Phoenix
Bastian Waidelich
bastian at typo3.org
Wed Jul 18 15:43:21 CEST 2012
Jacob Floyd wrote:
Hi Jacob,
> I've written a blog post explaining the background of why I'm using
> phoenix[1] and another about using fluid templates in Phoenix[2].
Great post! ;)
> In my section on terminology[3], have I defined Layouts > Templates >
> Partials correctly?
You write "The Layout includes Templates. Templates can include other
templates or partials. Partials might include other partials."
That is a bit misleading. I think, it's good to mention that the
template is always the *starting point*. A template can define a layout
with the layout view helper. The name "layout" is pretty
self-explanatory in my opinion. Other templating engines refer to it as
"master page".
"partials" can be compared with server side includes.
You also write "A layout (stored in Resources/Private/Layouts) Is the
overall outline of a fluid template"
Should be "stored in ... by default" as those paths are configurable.
Also it might make sense to emphasize that layouts are optional.
> Conceptually, how do we want to have 'sub-templates' (templates that apply
> to a certain branch of the site) defined in a site?
For now you can use a different template based on the node path.
Just put it in a folder under
Resources/Private/TypoScripts/<node>/<path> corresponding to the page
node. See:
http://git.typo3.org/FLOW3/Packages/TYPO3.T3con12QuebecTypo3Org.git?a=tree;f=Resources/Private/TypoScripts;h=b0973149a7227db1f05388601967989d2da3f5f1;hb=HEAD
> I guess as a stop-gap, I can create a TypoScript object that inserts a
> similar layout variable... Or perhaps there's a way to inject a variable in
> the fluid template based on where in the page tree it's being rendered?
> Does Sites.xml provide a way to have custom variables that are made
> available in Fluid?
If you set properties in the Sites.xml like:
<node type="TYPO3.TYPO3:Page" nodeName="someName">
<properties>
<title>Title</title>
<foo>Bar</foo>
</properties>
...
You can access them in the template via {context.properties.foo}
HTH,
--
Bastian Waidelich
TYPO3 Core Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list