<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty number_format modifier plugin
*
* Type: modifier<br>
* Name: number_format<br>
* Purpose: format numbers via number_format
* Example: {$sum|number_format:2:",":" "}
* @param int
* @param int
* @param string
* @param string
* @return int
*/
function smarty_modifier_number_format($number, $decimals, $dec_point=false, $thousands_sep=false)
{
if ($thousands_sep && $dec_point) {
return number_format($number, $decimals, $dec_point, $thousands_sep);
}
elseif ($thousands_sep==false && $dec_point) {
return number_format($number, $decimals, $dec_point,"");
}
else {
return number_format($number, $decimals);
}
}
/* vim: set expandtab: */
?>