f:or

If content is null/undefined use the text that’s provided as alternative.

Properties

content

Variable type
Mixed
Description
Content to check if null/undefined
Default value
NULL
Mandatory
No

alternative

Variable type
Mixed
Description
Alternative if content is null/undefined
Default value
NULL
Mandatory
No

arguments

Variable type
Array
Description
Arguments to be replaced in the resulting string, using sprintf
Default value
NULL
Mandatory
No

Examples

Tag notation

<f:or alternative="some text">{undefinedVariable}</f:or>

Inline notation

{f:or(content:undefinedVariable, alternative:'some other string')}

Inline notation II

{undefinedVariable -> f:or(alternative:'some %s text', arguments:{0: 'test'})}

Hint

Please keep in mind that f:or is checking on null/undefined and not on whether the content is “empty” or not.

For checking on “empty” it’s possible to simply use the ternary operator as show in the following example:

{undefinedVariable ? undefinedVariable : 'alternative string'}