PDA

View Full Version : Comma in Post Counts Causing trouble


Gutspiller
07-02-2003, 07:57 PM
I'm hoping somebody can help me with a problem I'm having. In my forum I included a comma in post counts so that instead of saying a post count of 50000 it would show up as 50,000. The problem is, is that sometimes it will not show the last digit so a post count of 50,000 would show up as 50,00 Can somebody help me fix this probem? Here are the instructions I used to get the comma in the post counts:


In admin/functions.php:
Look for:


code:
//highlight words for search engine





Add the following directly above it:

code:
if($post[posts] >= 1000) {
$left = floor($post[posts] / 1000);
$right = $post[posts] % 1000;
$post[posts] = "$left".","."$right";
}

Can somebody tell me if the intructions are messed up or what I can do to fix this problem? I will remove the comma before I put up with this problem any longer, but I was hoping somebody might be able to help me get the commas to work correctly.

Thanks in advance if somebody can help me.

filburt1
07-02-2003, 08:07 PM
You can just use:

$post['posts'] = number_format($post['posts']);

Gutspiller
07-02-2003, 08:21 PM
Today at 03:07 PM filburt1 said this in Post #2 (https://vborg.vbsupport.ru/showthread.php?postid=414799#post414799)
You can just use:

$post['posts'] = number_format($post['posts']);



So I would take out what I added to get the commas in, but where would I add the code that your talking about? :confused:

filburt1
07-02-2003, 09:51 PM
number_format adds commas; I thought that was your question (but then again I'm really tired ;)).

Gutspiller
07-09-2003, 03:27 AM
07-02-03 at 04:51 PM filburt1 said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=414820#post414820)
number_format adds commas; I thought that was your question (but then again I'm really tired ;)).


So how would I go about getting commas in the post count in user profiles?

noppid
07-09-2003, 03:42 PM
As Filburt pointed out, it's a one line fix. Throw away your code and use his one line.

Gutspiller
07-09-2003, 09:15 PM
Today at 10:42 AM noppid said this in Post #6 (https://vborg.vbsupport.ru/showthread.php?postid=416468#post416468)
As Filburt pointed out, it's a one line fix. Throw away your code and use his one line.


Unfortunantly it's not. I have that one line and I have many places where postcounts are as 56687 without a comma anywhere insight. :ermm: