Attention
TYPO3 v6 has reached its end-of-life April 18th, 2017 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
There is no further ELTS support. It is strongly recommended updating your project.
FLUIDTEMPLATE¶
The TypoScript object FLUIDTEMPLATE works in a similar way to the regular "marker"-based TEMPLATE object. However, it does not use markers or subparts, but allows Fluid-style variables with curly braces.
Note
The system extensions "fluid" and "extbase" need to be installed for this to work.
Properties¶
template¶
Property
template
Data type
Description
(Since TYPO3 6.1) Use this property to define a content object, which should be used as template file. It is an alternative to ".file"; if ".template" is set, it takes precedence. While any content object can be used here, the cObject FILE might be the usual choice.
file¶
Property
file
Data type
string /stdWrap
Description
The fluid template file. It is an alternative to ".template" and is used only, if ".template" is not set.
layoutRootPath¶
Property
layoutRootPath
Data type
file path /stdWrap
Description
Sets a specific layout path; usually it is Layouts/ underneath the template file.
layoutRootPaths¶
Property
layoutRootPaths
Data type
array of file paths
Description
Note
Mind the plural -s in "layoutRootPaths"!
Used to define several paths for layouts, which will be tried in reversed order (the paths are searched from bottom to top). The first folder where the desired layout is found, is used. If the array keys are numeric, they are first sorted and then tried in reversed order.
Example:
page.10 = FLUIDTEMPLATE
page.10 {
file = EXT:sitedesign/Resources/Private/Layouts/Main.html
layoutRootPaths {
10 = EXT:sitedesign/Resources/Private/Layouts/
20 = EXT:sitemodification/Resources/Private/Layouts/
}
}
If property layoutRootPath (singular) is also used, it will be placed as the first option in the list of fall back paths.
partialRootPath¶
Property
partialRootPath
Data type
file path /stdWrap
Description
Sets a specific partials path; usually it is Partials/ underneath the template file.
partialRootPaths¶
Property
partialRootPaths
Data type
array of file paths
Description
Note
Mind the plural -s in "partialRootPaths"!
Used to define several paths for partials, which will be tried in reversed order. The first folder where the desired partial is found is used. The keys of the array define the order.
See layoutRootPaths for other details.
Example:
page.10 = FLUIDTEMPLATE
page.10 {
file = EXT:sitedesign/Resources/Private/Layouts/Main.html
partialRootPaths {
10 = EXT:sitedesign/Resources/Private/Partials/
20 = EXT:sitemodification/Resources/Private/Partials/
}
}
format¶
Property
format
Data type
keyword /stdWrap
Description
Sets the format of the current request.
Default
html
extbase.pluginName¶
Property
extbase.pluginName
Data type
string /stdWrap
Description
Sets variables for initializing extbase.
extbase.controllerExtensionName¶
Property
extbase.controllerExtensionName
Data type
string /stdWrap
Description
Sets the extension name of the controller.
Important: This is for example essential if you have translations at the usual paths in your extension and want to use them right away in your template via <f:translate/>.
extbase.controllerName¶
Property
extbase.controllerName
Data type
string /stdWrap
Description
Sets the name of the controller.
extbase.controllerActionName¶
Property
extbase.controllerActionName
Data type
string /stdWrap
Description
Sets the name of the action.
variables¶
Property
variables
Data type
(array of cObjects)
Description
Sets variables that should be available in the fluid template. The keys are the variable names in Fluid.
Reserved variables are "data" and "current", which are filled automatically with the current data set.
settings¶
Property
settings
Data type
(array of keys)
Description
(Since TYPO3 6.1) Sets the given settings array in the fluid template. In the view, the value can then be used.
Example:
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
file = fileadmin/templates/MyTemplate.html
settings {
copyrightYear = 2013
}
}
To access copyrightYear in the template file use this:
{settings.copyrightYear}
Apart from just setting a key-value pair as done in the example, you can also reference objects or access constants as well.
Example:¶
The Fluid template (in fileadmin/templates/MyTemplate.html) could look like this:
<h1>{data.title}<f:if condition="{data.subtitle}">, {data.subtitle}</f:if></h1>
<h3>{mylabel}</h3>
<f:format.html>{data.bodytext}</f:format.html>
<p>© {settings.copyrightYear}</p>
You could use it with a TypoScript code like this:
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
template = FILE
template.file = fileadmin/templates/MyTemplate.html
partialRootPath = fileadmin/templates/partial/
variables {
mylabel = TEXT
mylabel.value = Label coming from TypoScript!
}
settings {
# Get the copyright year from a TypoScript constant.
copyrightYear = {$year}
}
}
As a result the page title and the label from TypoScript will be inserted as headlines. The copyright year will be taken from the TypoScript constant "year".