1 |
1546
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* QuickSkin Extension number
|
4 |
|
|
* Format a number with grouped thousands
|
5 |
|
|
*
|
6 |
|
|
* Usage Example:
|
7 |
|
|
* Content: $template->assign('SUM', 2500000);
|
8 |
|
|
* Template: Current balance: {number:SUM}
|
9 |
|
|
* Result: Current balance: 2.500.000,00
|
10 |
|
|
*
|
11 |
|
|
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de
|
12 |
|
|
*/
|
13 |
|
|
function qx_number ( $param ) {
|
14 |
|
|
global $_CONFIG;
|
15 |
|
|
|
16 |
|
|
$decimalChar = ',';
|
17 |
|
|
if ( !empty($_CONFIG['decimal_char']) ) {
|
18 |
|
|
$decimalChar = $_CONFIG['decimal_char'];
|
19 |
|
|
}
|
20 |
|
|
$decimalPlaces = 2;
|
21 |
|
|
if ( !empty($_CONFIG['decimal_places']) ) {
|
22 |
|
|
$decimalPlaces = $_CONFIG['decimal_places'];
|
23 |
|
|
}
|
24 |
|
|
$thousandsSep = '.';
|
25 |
|
|
if ( !empty($_CONFIG['thousands_sep']) ) {
|
26 |
|
|
$thousandsSep = $_CONFIG['thousands_sep'];
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
return number_format( $param, $decimalChar, $decimalPlaces, $thousandsSep );
|
30 |
|
|
}
|