Fluid syntax¶
Variables¶
Assign a variable in PHP:
$this->view->assign('title', 'An example title');
Output it in a Fluid template:
<h1>{title}</h1>
The result:
<h1>An example title</h1>
In the template’s HTML code, simply wrap the variable name into curly braces to output it:
Arrays and objects¶
Assign an array in PHP:
$this->view->assign('data', ['Low', 'High']);
Use the dot .
to access array keys:
EXT:site_package/Resources/Private/Templates/SomeTemplate.html¶
<p>{data.0}, {data.1}</p>
This also works for object properties:
EXT:site_package/Classes/Controller/SomeController.php¶
$this->view->assign('product', $myProduct);
Use it like this:
EXT:site_package/Resources/Private/Templates/SomeTemplate.html¶
<p>{product.name}: {product.price}</p>
ViewHelper attributes¶
See the Fluid Viewhelper Reference for a complete list of all available ViewHelpers.