Format.padding ViewHelper <f:format.padding>
ViewHelper to format a string to specific lengths, by using PHPs str_ function.
Go to the source code of this ViewHelper: Format\PaddingViewHelper.php (GitHub).
Table of contents
Examples
Defaults
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10">TYPO3</f:format.padding>
Copied!
Output
TYPO3␠␠␠␠␠
Copied!
Specify padding string
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
Copied!
Output
TYPO3-=-=-
Copied!
Specify padding type
packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
Copied!
Output
--TYPO3---
Copied!
Arguments of the <f:format.padding> ViewHelper
padLength
-
- Type
- int
- Required
- 1
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)
value
-
- Type
- string
string to format