[pmwiki-users] Formatting numbers

Scott Smith smackaysmith at gmail.com
Tue Jul 15 11:46:50 CDT 2008


Oh, I need to include the formatting stuff as well; e.g.,
  ${(numfmt {$:sum} 2, '.', ',')}

And the result for 22000 is now 22,000.00.

On Tue, Jul 15, 2008 at 12:38 PM, Scott Smith <smackaysmith at gmail.com>
wrote:

> I must be missing something. Let's say my sum is 22 and my argument is 0,
> the result is 22. If the argument is 1, the result is 220. If the argument
> is 2, 2200 is the result.
>
>
> On Tue, Jul 15, 2008 at 11:35 AM, Hans <design5 at softflow.co.uk> wrote:
>
>> 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
>>
>>  ~Hans
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20080715/4c886ec0/attachment.html 


More information about the pmwiki-users mailing list