Attention
TYPO3 v12 has reached end-of-life as of April 30th 2026 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here: TYPO3 ELTS.
Or ViewHelper <f:or>
Or ViewHelper
If content is null use alternative text.
Usage of f:or
{f:variable(name:'fallback',value:'this is not the variable you\'re looking for')}
{undefinedVariable -> f:or(alternative:fallback)}
Copied!
Usage of ternary operator
In some cases (e.g. when you want to check for empty instead of null) it might be more handy to use a ternary operator instead of f:or
{emptyVariable ?: 'this is an alterative text'}
Copied!
Go to the source code of this ViewHelper: OrViewHelper.php (GitHub).
Arguments
The following arguments are available for the or ViewHelper:
alternative
-
- Type
- mixed
Alternative if content is null
arguments
-
- Type
- array
Arguments to be replaced in the resulting string, using sprintf
content
-
- Type
- mixed
Content to check if null