f:variable

Assigns one template variable which will exist also after the ViewHelper is done rendering, i.e. adds template variables.

If you require a variable assignment which does not exist in the template after a piece of Fluid code is rendered, consider using f:alias instead.

Properties

name

Variable type
String
Description
Name of variable to create
Default value
NULL
Mandatory
Yes

value

Variable type
Mixed
Description
Value to assign. If not in arguments then taken from tag content
Default value
NULL
Mandatory
No

Examples

Tag notation

<f:variable name="myvariable" value="some value" />

Tag notation II

<f:variable name="myvariable">some value</f:variable>

Inline notation

{f:variable(name: 'myvariable', value: 'some value')}

Inline notation II

{oldvariable -> f:format.htmlspecialchars() -> f:variable(name: 'newvariable')}

Simple math

{f:variable(name: 'mycount', value: 0)}
{mycount}

> Output is “0”

{f:variable(name: 'mycount', value: '{mycount + 1}')}
{mycount}

> Output is now “1”