[pmwiki-users] Formatting numbers

Hans design5 at softflow.co.uk
Tue Jul 15 10:35:43 CDT 2008

Tuesday, July 15, 2008, 3:45:09 PM, Scott Smith wrote:

> I have a Fox form that adds a few currency amounts together. It would be
> nice if I could force ###.## formatting. The only thing I found that uses
> currency format is Sortable tables, but that recipe isn't right for this
> form.

try a custom markup expression:
add to config:

$MarkupExpr['numfmt'] = 'number_format($args[0], $args[1], $args[2], $args[3])';

use like {(numfmt {$:Sum} 2)}

first argument is floating point number.
second argument is integer for decimal places.
third argument is string for decimal point.
fourth argument is string for thousand separator.

I made no attempt to clean input values.

See http://us2.php.net/manual/en/function.number-format.php


More information about the pmwiki-users mailing list