---
title: "Or ViewHelper <f:or>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-or"
source: "ViewHelpers/Fluid/Or.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# Or ViewHelper `<f:or>` {#typo3fluid-fluid-or}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/Or.html) instead.

Or ViewHelper

If content is null use alternative text.

## Usage of f:or {#usage-of-f-or}

```php
{f:variable(name:'fallback',value:'this is not the variable you\'re looking for')}
{undefinedVariable -> f:or(alternative:fallback)}

```

## Usage of ternary operator {#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

```php
{emptyVariable ?: 'this is an alterative text'}
```

Go to the source code of this ViewHelper: [OrViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/OrViewHelper.php).

**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
