Fluid Syntax: Variables
Accessing variables
Variables in Fluid can be accessed with the following braces {} syntax:
<h1>{title}</h1>
Arrays and objects
Use the dot character . to access array keys:
<p>{data.0}, {data.1}</p>
This also works for object properties:
<p>{product.name}: {product.price}</p>
These object properties are obtained by evaluating a fallback chain,
which includes various getter methods as well as direct property access.
For example, the following PHP-equivalents would be checked for {product.:
$product->getName()
$product->isName()
$product->hasName()
$product->name
Also, both Array and the PSR Container are supported.
Dynamic keys/properties
It is possible to access array or object values by a dynamic index:
{myArray.{myIndex}}
Reserved variable names
The following variable names are reserved and must not be used:
_alltruefalsenull
New in version Fluid 5.0
Starting with Fluid 5, all variable names starting with an underscore are reserved for internal purposes as well. Note that this only affects the primary variable name, not the name of array keys or object properties.
<!-- invalid variable access -->
{_temp}
{_somethingElse}
<!-- valid variable access -->
{data._something}
{myArray._myKey}