.. _`TYPO3 Fluid ViewHelper Reference`:
TYPO3 Fluid ViewHelper Reference
################################
This reference was automatically generated from code on 2026-06-05
.. _`TYPO3 Fluid ViewHelper Reference: f:alias`:
f:alias
-------
Declares new variables which are aliases of other variables.
Takes a "map"-Parameter which is an associative array which defines the shorthand mapping.
The variables are only declared inside the ``...`` tag. After the
closing tag, all declared variables are removed again.
Using this ViewHelper can be a sign of weak architecture. If you end up
using it extensively you might want to fine-tune your "view model" (the
data you assign to the view).
Examples
========
Single alias
------------
::
{x}
Output::
foo
Multiple mappings
-----------------
::
{x.name} or {y}
Output::
[name] or [name]
Depending on ``{foo.bar.baz}``.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\AliasViewHelper
Arguments
*********
* ``map`` (array): Array that specifies which variables should be mapped to which alias
.. _`TYPO3 Fluid ViewHelper Reference: f:cache.disable`:
f:cache.disable
---------------
ViewHelper to disable template compiling
Inserting this ViewHelper at any point in the template,
including inside conditions which do not get rendered,
will forcibly disable the caching/compiling of the full
template file to a PHP class.
Use this if for whatever reason your platform is unable
to create or load PHP classes (for example on read-only
file systems or when using an incompatible default cache
backend).
Passes through anything you place inside the ViewHelper,
so can safely be used as container tag, as self-closing
or with inline syntax - all with the same result.
Examples
========
Self-closing
------------
::
Inline mode
-----------
::
{f:cache.disable()}
Container tag
-------------
::
Some output or Fluid code
Additional output is also not compilable because of the ViewHelper
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Cache\\DisableViewHelper
.. _`TYPO3 Fluid ViewHelper Reference: f:cache.static`:
f:cache.static
--------------
ViewHelper to force compiling to a static string
Used around chunks of template code where you want the
output of said template code to be compiled to a static
string (rather than a collection of compiled nodes, as
is the usual behavior).
The effect is that none of the child ViewHelpers or nodes
used inside this tag will be evaluated when rendering the
template once it is compiled. It will essentially replace
all logic inside the tag with a plain string output.
Works by turning the ``compile`` method into a method that
renders the child nodes and returns the resulting content
directly as a string variable.
You can use this with great effect to further optimise the
performance of your templates: in use cases where chunks of
template code depend on static variables (like thoese in
``{settings}`` for example) and those variables never change,
and the template uses no other dynamic variables, forcing
the template to compile that chunk to a static string can
save a lot of operations when rendering the compiled template.
NB: NOT TO BE USED FOR CACHING ANYTHING OTHER THAN STRING-
COMPATIBLE OUTPUT!
USE WITH CARE! WILL PRESERVE EVERYTHING RENDERED, INCLUDING
POTENTIALLY SENSITIVE DATA CONTAINED IN OUTPUT!
Examples
========
Usage and effect
----------------
::
Is always evaluated also when compiled
Will only be evaluated once and this output will be
cached as a static string with no logic attached.
The compiled template will not contain neither the
condition ViewHelperNodes or the variable accessor
that are used inside this node.
This is also evaluated when compiled (static node is closed)::
Also evaluated; is outside static node
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Cache\\StaticViewHelper
.. _`TYPO3 Fluid ViewHelper Reference: f:cache.warmup`:
f:cache.warmup
--------------
ViewHelper to insert variables which only apply during
cache warmup and only apply if no other variables are
specified for the warmup process.
If a chunk of template code is impossible to compile
without additional variables, for example when rendering
sections or partials using dynamic names, you can use this
ViewHelper around that chunk and specify a set of variables
which will be assigned only while compiling the template
and only when this is done as part of cache warmup. The
template chunk can then be compiled using those default
variables.
This does not imply that only those variable values will
be used by the compiled template. It only means that
DEFAULT values of vital variables will be present during
compiling.
If you find yourself completely unable to properly warm up
a specific template file even with use of this ViewHelper,
then you can consider using
``f:cache.disable`` ViewHelper
to prevent the template compiler from even attempting to
compile it.
USE WITH CARE! SOME EDGE CASES OF FOR EXAMPLE VIEWHELPERS
WHICH REQUIRE SPECIAL VARIABLE TYPES MAY NOT BE SUPPORTED
HERE DUE TO THE RUDIMENTARY NATURE OF VARIABLES YOU DEFINE.
Examples
========
Usage and effect
----------------
::
Template code depending on {foo} variable which is not
assigned when warming up Fluid's caches. {foo} is only
assigned if the variable does not already exist and the
assignment only happens if Fluid is in warmup mode.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Cache\\WarmupViewHelper
Arguments
*********
* ``variables`` (array, *optional*): Array of variables to assign ONLY when compiling. See main class documentation.
.. _`TYPO3 Fluid ViewHelper Reference: f:case`:
f:case
------
Case ViewHelper that is only usable within the ``f:switch`` ViewHelper.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\CaseViewHelper
Arguments
*********
* ``value`` (mixed): Value to match in this case
.. _`TYPO3 Fluid ViewHelper Reference: f:comment`:
f:comment
---------
This ViewHelper prevents rendering of any content inside the tag.
Contents of the comment will still be **parsed** thus throwing an
Exception if it contains syntax errors. You can put child nodes in
CDATA tags to avoid this.
Using this ViewHelper won't have a notable effect on performance,
especially once the template is parsed. However, it can lead to reduced
readability. You can use layouts and partials to split a large template
into smaller parts. Using self-descriptive names for the partials can
make comments redundant.
Examples
========
Commenting out fluid code
-------------------------
::
Before
This is completely hidden.
This does not get rendered
After
Output::
Before
After
Prevent parsing
---------------
::
]]>
Output:
Will be nothing.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\CommentViewHelper
.. _`TYPO3 Fluid ViewHelper Reference: f:constant`:
f:constant
----------
Wrapper for PHPs :php:`constant` function.
See https://www.php.net/manual/function.constant.php.
Examples
========
Get built-in PHP constant
-------------------------
::
{f:constant(name: 'PHP_INT_MAX')}
Output::
9223372036854775807
(Depending on CPU architecture).
Get class constant
------------------
::
{f:constant(name: '\Vendor\Package\Class::CONSTANT')}
Get enum value
--------------
::
{f:constant(name: '\Vendor\Package\Enum::CASE')}
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\ConstantViewHelper
Arguments
*********
* ``name`` (string, *optional*): String representation of a PHP constant or enum
.. _`TYPO3 Fluid ViewHelper Reference: f:count`:
f:count
-------
This ViewHelper counts elements of the specified array or countable object.
Examples
========
Count array elements
--------------------
::
Output::
4
inline notation
---------------
::
{objects -> f:count()}
Output::
10 (depending on the number of items in ``{objects}``)
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\CountViewHelper
Arguments
*********
* ``subject`` (array, *optional*): Countable subject, array or \Countable
.. _`TYPO3 Fluid ViewHelper Reference: f:cycle`:
f:cycle
-------
This ViewHelper cycles through the specified values.
This can be often used to specify CSS classes for example.
To achieve the "zebra class" effect in a loop you can also use the
"iteration" argument of the **for** ViewHelper.
Examples
========
These examples could also be achieved using the "iteration" argument
of the ForViewHelper.
Simple
------
::
{cycle}
Output::
foobarbazfoo
Alternating CSS class
---------------------
::
Output::
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\CycleViewHelper
Arguments
*********
* ``values`` (array, *optional*): The array or object implementing \ArrayAccess (for example \SplObjectStorage) to iterated over
* ``as`` (string): The name of the iteration variable
.. _`TYPO3 Fluid ViewHelper Reference: f:debug`:
f:debug
-------
This ViewHelper is only meant to be used during development.
Examples
========
Inline notation and custom title
--------------------------------
::
{object -> f:debug(title: 'Custom title')}
Output::
all properties of {object} nicely highlighted (with custom title)
Only output the type
--------------------
::
{object -> f:debug(typeOnly: true)}
Output::
the type or class name of {object}
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\DebugViewHelper
Arguments
*********
* ``typeOnly`` (boolean, *optional*): If true, debugs only the type of variables
* ``levels`` (integer, *optional*): Levels to render when rendering nested objects/arrays
* ``html`` (boolean, *optional*): Render HTML. If false, output is indented plaintext
.. _`TYPO3 Fluid ViewHelper Reference: f:defaultCase`:
f:defaultCase
-------------
A ViewHelper which specifies the "default" case when used within the ``f:switch`` ViewHelper.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\DefaultCaseViewHelper
.. _`TYPO3 Fluid ViewHelper Reference: f:else`:
f:else
------
Else-Branch of a condition. Only has an effect inside of ``f:if``.
See the ``f:if`` ViewHelper for documentation.
Examples
========
Output content if condition is not met
--------------------------------------
::
condition was not true
Output::
Everything inside the "else" tag is displayed if the condition evaluates to false.
Otherwise, nothing is outputted in this example.
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\ElseViewHelper
Arguments
*********
* ``if`` (boolean, *optional*): Condition expression conforming to Fluid boolean rules
.. _`TYPO3 Fluid ViewHelper Reference: f:first`:
f:first
-------
The FirstViewHelper returns the first item of an array.
Example
========
::
.. code-block:: text
first
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\FirstViewHelper
Arguments
*********
* ``value`` (array, *optional*)
.. _`TYPO3 Fluid ViewHelper Reference: f:for`:
f:for
-----
Loop ViewHelper which can be used to iterate over arrays.
Implements what a basic PHP ``foreach()`` does.
Examples
========
Simple Loop
-----------
::
{foo}
Output::
1234
Output array key
----------------
::
Output::
- fruit1: apple
- fruit2: pear
- fruit3: banana
- fruit4: cherry
Iteration information
---------------------
::
- Index: {fooIterator.index} Cycle: {fooIterator.cycle} Total: {fooIterator.total}{f:if(condition: fooIterator.isEven, then: ' Even')}{f:if(condition: fooIterator.isOdd, then: ' Odd')}{f:if(condition: fooIterator.isFirst, then: ' First')}{f:if(condition: fooIterator.isLast, then: ' Last')}
Output::
- Index: 0 Cycle: 1 Total: 4 Odd First
- Index: 1 Cycle: 2 Total: 4 Even
- Index: 2 Cycle: 3 Total: 4 Odd
- Index: 3 Cycle: 4 Total: 4 Even Last
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\ForViewHelper
Arguments
*********
* ``each`` (array): The array or \SplObjectStorage to iterated over
* ``as`` (string): The name of the iteration variable
* ``key`` (string, *optional*): Variable to assign array key to
* ``reverse`` (boolean, *optional*): If true, iterates in reverse
* ``iteration`` (string, *optional*): The name of the variable to store iteration information (index, cycle, total, isFirst, isLast, isEven, isOdd)
.. _`TYPO3 Fluid ViewHelper Reference: f:format.case`:
f:format.case
-------------
Modifies the case of an input string to upper- or lowercase or capitalization.
The default transformation will be uppercase as in `mb_convert_case`_.
Possible modes are:
``lower``
Transforms the input string to its lowercase representation
``upper``
Transforms the input string to its uppercase representation
``capital``
Transforms the input string to its first letter upper-cased, i.e. capitalization
``uncapital``
Transforms the input string to its first letter lower-cased, i.e. uncapitalization
``capitalWords``
Not supported yet: Transforms the input string to each containing word being capitalized
Note that the behavior will be the same as in the appropriate PHP function `mb_convert_case`_;
especially regarding locale and multibyte behavior.
.. _mb_convert_case: https://www.php.net/manual/function.mb-convert-case.php
Examples
========
Default
-------
::
Some Text with miXed case
Output::
SOME TEXT WITH MIXED CASE
Example with given mode
-----------------------
::
someString
Output::
SomeString
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\CaseViewHelper
Arguments
*********
* ``value`` (string, *optional*): The input value. If not given, the evaluated child nodes will be used.
* ``mode`` (string, *optional*): The case to apply, must be one of this' CASE_* constants. Defaults to uppercase application.
.. _`TYPO3 Fluid ViewHelper Reference: f:format.cdata`:
f:format.cdata
--------------
Outputs an argument/value without any escaping and wraps it with CDATA tags.
PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting),
as the output is NOT SANITIZED!
Examples
========
Child nodes
-----------
::
{string}
Output::
Value attribute
---------------
::
Output::
Inline notation
---------------
::
{string -> f:format.cdata()}
Output::
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\CdataViewHelper
Arguments
*********
* ``value`` (mixed, *optional*): The value to output
.. _`TYPO3 Fluid ViewHelper Reference: f:format.htmlspecialchars`:
f:format.htmlspecialchars
-------------------------
Applies PHP ``htmlspecialchars()`` escaping to a value.
See http://www.php.net/manual/function.htmlspecialchars.php
Examples
========
Default notation
----------------
::
{text}
Output::
Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
Inline notation
---------------
::
{text -> f:format.htmlspecialchars(encoding: 'ISO-8859-1')}
Output::
Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper
Arguments
*********
* ``value`` (string, *optional*): Value to format
* ``keepQuotes`` (boolean, *optional*): If true quotes will not be replaced (ENT_NOQUOTES)
* ``encoding`` (string, *optional*): Encoding
* ``doubleEncode`` (boolean, *optional*): If false, html entities will not be encoded
.. _`TYPO3 Fluid ViewHelper Reference: f:format.json`:
f:format.json
-------------
Wrapper for PHPs :php:`json_encode` function.
See https://www.php.net/manual/function.json-encode.php.
Examples
========
Encoding a view variable
------------------------
::
{someArray -> f:format.json()}
``["array","values"]``
Depending on the value of ``{someArray}``.
Associative array
-----------------
::
{f:format.json(value: {foo: 'bar', bar: 'baz'})}
``{"foo":"bar","bar":"baz"}``
Non associative array with forced object
----------------------------------------
::
{f:format.json(value: {0: 'bar', 1: 'baz'}, forceObject: true)}
``{"0":"bar","1":"baz"}``
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\JsonViewHelper
Arguments
*********
* ``value`` (mixed, *optional*): The incoming data to convert, or null if VH children should be used
* ``forceObject`` (bool, *optional*): Outputs an JSON object rather than an array
.. _`TYPO3 Fluid ViewHelper Reference: f:format.nl2br`:
f:format.nl2br
--------------
Wrapper for PHPs :php:`nl2br` function.
See https://www.php.net/manual/function.nl2br.php.
Examples
========
Default
-------
::
{text_with_linebreaks}
Text with line breaks replaced by ``
``
Inline notation
---------------
::
{text_with_linebreaks -> f:format.nl2br()}
Text with line breaks replaced by ``
``
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\Nl2brViewHelper
Arguments
*********
* ``value`` (string, *optional*): string to format
.. _`TYPO3 Fluid ViewHelper Reference: f:format.number`:
f:format.number
---------------
Formats a number with custom precision, decimal point and grouped thousands.
See https://www.php.net/manual/function.number-format.php.
Examples
========
Defaults
--------
::
423423.234
``423,423.20``
With all parameters
-------------------
::
423423.234
``423.423,2``
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\NumberViewHelper
Arguments
*********
* ``decimals`` (int, *optional*): The number of digits after the decimal point
* ``decimalSeparator`` (string, *optional*): The decimal point character
* ``thousandsSeparator`` (string, *optional*): The character for grouping the thousand digits
.. _`TYPO3 Fluid ViewHelper Reference: f:format.printf`:
f:format.printf
---------------
A ViewHelper for formatting values with printf. Either supply an array for
the arguments or a single value.
See http://www.php.net/manual/en/function.sprintf.php
Examples
========
Scientific notation
-------------------
::
%.3e
Output::
3.625e+8
Argument swapping
-----------------
::
%2$s is great, TYPO%1$d too. Yes, TYPO%1$d is great and so is %2$s!
Output::
Kasper is great, TYPO3 too. Yes, TYPO3 is great and so is Kasper!
Single argument
---------------
::
We love %s
Output::
We love TYPO3
Inline notation
---------------
::
{someText -> f:format.printf(arguments: {1: 'TYPO3'})}
Output::
We love TYPO3
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\PrintfViewHelper
Arguments
*********
* ``value`` (string, *optional*): String to format
* ``arguments`` (array, *optional*): The arguments for vsprintf
.. _`TYPO3 Fluid ViewHelper Reference: f:format.raw`:
f:format.raw
------------
Outputs an argument/value without any escaping. Is normally used to output
an ObjectAccessor which should not be escaped, but output as-is.
PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting),
as the output is NOT SANITIZED!
Examples
========
Child nodes
-----------
::
{string}
Output::
(Content of ``{string}`` without any conversion/escaping)
Value attribute
---------------
::
Output::
(Content of ``{string}`` without any conversion/escaping)
Inline notation
---------------
::
{string -> f:format.raw()}
Output::
(Content of ``{string}`` without any conversion/escaping)
:Implementation: TYPO3Fluid\\Fluid\\ViewHelpers\\Format\\RawViewHelper
Arguments
*********
* ``value`` (mixed, *optional*): The value to output
.. _`TYPO3 Fluid ViewHelper Reference: f:format.stripTags`:
f:format.stripTags
------------------
Removes tags from the given string (applying PHPs :php:`strip_tags()` function)
See https://www.php.net/manual/function.strip-tags.php.
Examples
========
Default notation
----------------
::
Some Text with Tags and an Ümlaut.
Some Text with Tags and an Ümlaut. :php:`strip_tags()` applied.
.. note::
Encoded entities are not decoded.
Default notation with allowedTags
---------------------------------
::
paragraph
spandivider
Output::
paragraph
spandivider
iframe
Inline notation
---------------
::
{text -> f:format.stripTags()}
Text without tags :php:`strip_tags()` applied.
Inline notation with allowedTags
--------------------------------
::
{text -> f:format.stripTags(allowedTags: "