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 v10 here: TYPO3 ELTS.
numberFormat
With this property you can format a float value and display it as you
want, for example as a price. It is a wrapper for the number_
function of PHP.
You can define how many decimals you want and which separators you want for decimals and thousands.
Since the properties are finally used by the PHP function
number_
, you need to make sure that they are valid parameters
for that function. Consult the PHP manual, if unsure.
Properties
decimals
dec_point
thousands_sep
Examples
lib.myPrice = TEXT
lib.myPrice {
value = 0.8
stdWrap.numberFormat {
decimals = 2
dec_point.cObject = TEXT
dec_point.cObject {
value = .
stdWrap.lang.de = ,
}
}
stdWrap.noTrimWrap = || €|
}
# Will basically result in "0.80 €", but for German in "0,80 €".
lib.carViews = CONTENT
lib.carViews {
table = tx_mycarext_car
select.pidInList = 42
renderObj = TEXT
renderObj {
stdWrap.field = views
# By default use 3 decimals or
# use the number given by the Get/Post variable precisionLevel, if set.
stdWrap.numberFormat.decimals = 3
stdWrap.numberFormat.decimals.override.data = GP:precisionLevel
stdWrap.numberFormat.dec_point = ,
stdWrap.numberFormat.thousands_sep = .
}
}
# Could result in something like "9.586,007".