The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Commas in post count

3 posters

Go down

Commas in post count Empty Commas in post count

Post by Xanthis Tue Aug 09, 2011 12:30 am

Is there some way to change the counters so there's a comma inserted every third digit, like in the post count in user's profiles, or total number of registered users?


Last edited by Xanthis on Sun Aug 14, 2011 10:52 pm; edited 1 time in total
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by hoodedwarbler12 Tue Aug 09, 2011 12:55 am

So if there are 10,000 posts it doesn't already out a comma?
hoodedwarbler12
hoodedwarbler12
Forumember

Male Posts : 521
Reputation : 117
Language : English, Latin, HTML, JavaScript
Location : Tennessee, USA

http://www.webkinznation.com

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Xanthis Tue Aug 09, 2011 1:20 am

hoodedwarbler12 wrote:So if there are 10,000 posts it doesn't already out a comma?

No.

Code:
{FORUMCOUNTPOST}

Forumotion's total message count, without the code tags, shows up like this: 1087992. You can quote this message to double check.
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by hoodedwarbler12 Tue Aug 09, 2011 1:24 am

Oh. Well, there's no way to add this without a change to our forums by The Godfather. You could suggest it if you wish. Smile
hoodedwarbler12
hoodedwarbler12
Forumember

Male Posts : 521
Reputation : 117
Language : English, Latin, HTML, JavaScript
Location : Tennessee, USA

http://www.webkinznation.com

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Mike Tue Aug 09, 2011 2:45 am

Try and add this Javascript to your forum

Code:
<script type="text/javascript">function CommaFormatted(amount)
{
   var delimiter = ","; // replace comma if desired
   amount = new String(amount);
   var a = amount.split('.',2)
   var d = a[1];
   var i = parseInt(a[0]);
   if(isNaN(i)) { return ''; }
   var minus = '';
   if(i < 0) { minus = '-'; }
   i = Math.abs(i);
   var n = new String(i);
   var a = [];
   while(n.length > 3)
   {
      var nn = n.substr(n.length-3);
      a.unshift(nn);
      n = n.substr(0,n.length-3);
   }
   if(n.length > 0) { a.unshift(n); }
   n = a.join(delimiter);
   if(d.length < 1) { amount = n; }
   else { amount = n + '.' + d; }
   amount = minus + amount;
   return amount;
}
// end of function CommaFormatted()</script>
Mike
Mike
Hyperactive

Male Posts : 4255
Reputation : 471
Language : English, HTML, CSS
Location : Loveland, Colorado

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Xanthis Sun Aug 14, 2011 10:18 pm

Drogba, I'm not entirely sure that the code you gave me works, I submitted it in the form you gave me, and there was no effect, then I deleted the HTML script tags and re-submitted it, and it still doesn't show up. Any suggestions?
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Xanthis Tue Aug 16, 2011 6:54 pm

Bumping.
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Xanthis Fri Aug 19, 2011 7:40 pm

Bump of redundancy #2.
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Commas in post count Empty Re: Commas in post count

Post by Xanthis Mon Aug 29, 2011 12:42 am

Bump #3?
Xanthis
Xanthis
Forumember

Male Posts : 210
Reputation : 6
Language : English

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum