Dear Drupal friends,

i am trying to use number_format() function in Display Format Field of the computed field of the node to change the decimal point to comma (1000,00) but no matter what i try, i doesn't change. Do you have any idea how can i fix this? Thank you.

Code from Display Format Field:

$display = number_format($node_field_item[0]['value'],2,",",".");

Comments

kvvnn’s picture

Get rid of the [0] after your [value].

Also: "Note: this code has no effect if you use the "Computed Value" formatter option"

So use "Plain Text" instead of "Computed Value" in Views / Node Fields Display options

http://drupal.org/node/374279

Problem 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

s.kampylis’s picture

Thanks a lot Kevin. It worked perfectly. You saved my life.

kvvnn’s picture

: )

tomsm’s picture

I have a question: How do I hide the decimal number if they are "00".
So that a value like 5.124,00 is displayed as 5.124

dqd’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Due to the Drupal core life cycle policy and security support advisery, Drupal 6 is no longer supported. So issues for Drupal 6 cannot be longer maintained. The project maintainer has asked for closing all D6 issues to clean up the issue queue.