ViewHelpers
f:split
The SplitViewHelper splits a string by the specified separator, which results in an array. The number of values in the resulting array can be limited with the limit parameter, which results in an array where the last item contains the remaining unsplit string.
This ViewHelper mimicks PHP's
explode function.
The following examples store the result in a variable because an array cannot be outputted directly in a template.
Examples
Split with a separator
<f:variable name="result"><f:split value="1,5,8" separator="," /></f:variable>
{0: '1', 1: '5', 2: '8'}
Split using tag content as value
<f:variable name="result"><f:split separator="-">1-5-8</f:split></f:variable>
{0: '1', 1: '5', 2: '8'}
Split with a limit
<f:variable name="result"><f:split value="1,5,8" separator="," limit="2" /></f:variable>
{0: '1', 1: '5,8'}
Arguments
The following arguments are available for the split ViewHelper:
limit
-
- Type
- int
- Default
- 9223372036854775807
If limit is positive, a maximum of $limit items will be returned. If limit is negative, all items except for the last $limit items will be returned. 0 will be treated as 1.
separator
-
- Type
- string
- Required
- 1
Separator string to explode with
value
-
- Type
- string
The string to explode
The SplitViewHelper splits a string by the specified separator, which results in an array. The number of values in the resulting array can be limited with the limit parameter, which results in an array where the last item contains the remaining unsplit string.
This ViewHelper mimicks PHP's
explode function.
The following examples store the result in a variable because an array cannot be outputted directly in a template.
Examples
Split with a separator
<f:variable name="result"><f:split value="1,5,8" separator="," /></f:variable>
{0: '1', 1: '5', 2: '8'}
Split using tag content as value
<f:variable name="result"><f:split separator="-">1-5-8</f:split></f:variable>
{0: '1', 1: '5', 2: '8'}
Split with a limit
<f:variable name="result"><f:split value="1,5,8" separator="," limit="2" /></f:variable>
{0: '1', 1: '5,8'}
Arguments
The following arguments are available for the split ViewHelper:
value
-
value -
- Type
- string
The string to explode
separator
-
separator -
- Type
- string
- Required
- 1
Separator string to explode with
limit
-
limit -
- Type
- int
- Default
- 9223372036854775807
If limit is positive, a maximum of $limit items will be returned. If limit is negative, all items except for the last $limit items will be returned. 0 will be treated as 1.
f:link.external
ViewHelper for creating links to external targets.
<f:link.external uri="https://www.typo3.org" target="_blank">external link</f:link.external>
Arguments
Allows arbitrary arguments
This ViewHelper allows you to pass arbitrary arguments not defined below directly
to the HTML tag created. This includes custom
data- arguments.
The following arguments are available for the link.external ViewHelper:
additionalAttributes
-
- Type
- array
Additional tag attributes. They will be added directly to the resulting HTML tag.
aria
-
- Type
- array
Additional aria-* attributes. They will each be added with a "aria-" prefix.
data
-
- Type
- array
Additional data-* attributes. They will each be added with a "data-" prefix.
defaultScheme
-
- Type
- string
- Default
- 'https'
Scheme the href attribute will be prefixed with if specified $uri does not contain a scheme already
uri
-
- Type
- string
- Required
- 1
The URI that will be put in the href attribute of the rendered link tag
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
<f:if condition="{someCondition}">
<f:else>
condition was not true
</f:else>
</f:if>
Output:
Everything inside the "else" tag is displayed if the condition evaluates to false.
Otherwise, nothing is outputted in this example.
Arguments
The following arguments are available for the else ViewHelper:
if
-
- Type
- boolean
Condition expression conforming to Fluid boolean rules
f:deprecated
Deprecated
Example for deprecated ViewHelper and complex types
formvh:be.maximumFileSize
Internal
This ViewHelper is marked as internal. It is subject to be changed without notice. Use at your own risk.
Return the max file size for use in the form editor
Scope: backend
Go to the source code of this ViewHelper: Be\MaximumFileSizeViewHelper.php (GitHub).