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.currency ViewHelper <f:format.currency>
Formats a given float to a currency representation.
Examples
Defaults
<f:format.currency>123.456</f:format.currency>
Output:
123,46
All parameters
<f:format.currency decimalSeparator="." thousandsSeparator="," decimals="2"
currencySign="$" prependCurrency="true" separateCurrency="false"
>
54321
</f:format.currency>
Output:
$54,321.00
Inline notation
{someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: 'EUR')}
Output:
54,321,00 EUR
Depending on the value of {someNumber}
.
Use dash for decimals without value
<f:format.currency useDash="true">123.00</f:format.currency>
Output:
123,-
Source code
Go to the source code of this ViewHelper: CurrencyViewHelper.php (GitHub).
Arguments
The following arguments are available for <f:
:
currencySign
-
- Type
- string
The currency sign, eg $ or .
decimalSeparator
-
- Type
- string
- Default
','
The separator for the decimal point.
thousandsSeparator
-
- Type
- string
- Default
'.'
The thousands separator.
prependCurrency
-
- Type
- boolean
Select if the currency sign should be prepended
separateCurrency
-
- Type
- boolean
- Default
true
Separate the currency sign from the number by a single space, defaults to true due to backwards compatibility
decimals
-
- Type
- mixed
- Default
2
Set decimals places.
useDash
-
- Type
- boolean
Use the dash instead of decimal 00