Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 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 v11 here: TYPO3 ELTS.
Format.padding ViewHelper <f:format.padding>
Formats a string using PHPs str_
function.
See https://www.php.net/manual/en/function.str-pad.
Examples
Defaults
<f:format.padding padLength="10">TYPO3</f:format.padding>
Output:
TYPO3
TYPO3
Specify padding string
<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
TYPO3-=-=-
Specify padding type
<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
--TYPO3---
Source code
Go to the source code of this ViewHelper: PaddingViewHelper.php (GitHub).
Arguments
The following arguments are available for <f:
:
value
-
- Type
- string
String to format
padLength
-
- Type
- mixed
- Required
true
Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, no padding takes place.
padString
-
- Type
- string
- Default
' '
The padding string
padType
-
- Type
- string
- Default
'right'
Append the padding at this site (Possible values: right,left,both. Default: right)