Re: [SMARTY] money_format()
| From: | Gabriel Birke | Date: | Mon, 07 Apr 2003 15:19:14 +0000 |
| Subject: | Re: [SMARTY] money_format() | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9167@lists.php.net to get a copy of this message | ||
On Monday, 07.04.03 um 16:07 Uhr Thorsten Schmidt wrote:
I'm searching for a pendant to money_format(). I want to modify a money string 54235.52 (coming from DB) to 54.235,52.Just write a modifier as a wrapper for the PHP function number_format: function smarty_modifier_number_format($string, $decimals=2, $dec_point=".", $thousands_sep=",") { return number_format($string,int decimals, $decimals, $dec_point, $thousands_sep); } Save it as modifier.number_format in your smarty/plugins dir. in the template, write: {$my_number|number_format:2:",":"."} for your preferred output format With best regards Gabriel Birke -- KONTOR4_Neue Medien Nelkenstrasse 3 31515 Wunstorf Germany +49 5031-955234 +49 5031-955231 mailto:birke@kontor4.de http://www.kontor4.de