wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
modifier.money_format.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Smarty plugin
4  * @package Smarty
5  * @subpackage plugins
6  */
7 
8 /**
9  * Smarty money_format modifier plugin
10  *
11  * Type: modifier<br>
12  * Name: money_format<br>
13  * Purpose: Formats a number as a html-encoded currency string
14  * @link http://www.php.net/money_format
15  * @param float
16  * @param integer (default 0)
17  * @return string (html-encoded)
18  */
19 function smarty_modifier_money_format($number, $leftFill='0')
20 {
21  if (function_exists('money_format'))
22  {
23  setlocale(LC_MONETARY, 'de_DE.UTF8');
24  $format = (!empty($leftFill))?'%!#'.$leftFill.'n':'%!n';
25  return str_replace(' ','&nbsp;',money_format($format, $number));
26  }
27  else {
28  return $number;
29  }
30 }
31 ?>
smarty_modifier_money_format($number, $leftFill='0')