Formatted text for PHP text counter

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
Eric
Posts: 3
Joined: Thu Apr 26, 2007 8:22 pm

Formatted text for PHP text counter

Post 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
Eric
Eric
Posts: 3
Joined: Thu Apr 26, 2007 8:22 pm

Post 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
Eric
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

I like people who find solutions by themselves and share it with others. :D
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Eric
Posts: 3
Joined: Thu Apr 26, 2007 8:22 pm

Post 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!
Eric
wads24
Posts: 4
Joined: Fri Aug 16, 2013 7:07 am

Re: Formatted text for PHP text counter

Post 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.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Re: Formatted text for PHP text counter

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply