Page 1 of 1

Formatted text for PHP text counter

Posted: Fri Apr 27, 2007 1:19 am
by Eric
Script URL:
Version of script:1.0
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: comma, formatted

Write your message below:
Is it possible to configure the text counter to display formatted text with commas between the thousands? For example 12,345 instead of 12345.

Thanks, Eric

Posted: Fri Apr 27, 2007 3:53 am
by Eric
After finding this post regarding CCount, I think we sould do a similar mod to text counter.
Klemen Stirn wrote:- find this line:

Code: Select all

echo "ccount_link[$id]=$count;\n";
- change it to:

Code: Select all

echo "ccount_link[$id]='".number_format($count)."';\n";
I located the code that needed to be changed

Code: Select all

// Print out Javascript code and exit
echo "document.write('$count');";
and changed it to

Code: Select all

// Print out Javascript code and exit
echo "document.write('".number_format($count)."');";
I was afraid it'd be confused with the single and double quotes but it seems to work. :D

Eric

Posted: Fri Apr 27, 2007 10:14 am
by Klemen
I like people who find solutions by themselves and share it with others. :D

Posted: Fri Apr 27, 2007 9:46 pm
by Eric
Klemen Stirn wrote:I like people who find solutions by themselves and share it with others. :D
...and I like people who develop nifty code in the first place and share it with others!

Re: Formatted text for PHP text counter

Posted: Fri Aug 16, 2013 7:09 am
by wads24
I am sorry, but this instruction did not help me. Could someone tell me if this is still good instructions to add comma? what file do i open? I tried to edit counter.php but could not find the text above in searches.

Re: Formatted text for PHP text counter

Posted: Fri Aug 16, 2013 7:13 am
by Klemen
These are the steps:

1. open file "counter.php" in a text editor
2. find this line (almost at the end)

Code: Select all

echo 'document.write(\''.$count.'\');';
3. change it to

Code: Select all

echo 'document.write(\''.number_format($count).'\');';
4. save, upload and test