Closed (fixed)
Project:
Computed Field
Version:
6.x-1.0-beta2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Feb 2009 at 02:37 UTC
Updated:
15 Feb 2009 at 07:20 UTC
the computed field works excellently.
There's a very simple code snippet that shows how to add two fields together: http://drupal.org/node/149233 and put a $ in front of the result.
Suppose the answer is a large number? How would you format the result so that it has commas such as $1,000,000.00?
Thanks.
/TL
Comments
Comment #1
tlash commentedProblem solved. Sorry for such a lame post. I'm learning PHP slowly.
In case anybody else is interested. Here's how you put punctuation into the display of a CCK computed field.
In the display section replace the default:
$display = $node_field_item['value'];
with:
$display = '$' . number_format($node_field_item['value'] , 2, '.', ',');
To turn 10000.00 into $10,000.00
/TL
Comment #2
tlash commented