View Full Version : How do I add commas in the # of threads and posts?
Gutspiller
01-11-2003, 01:40 AM
On the index page of my forum where it shows the threads and the posts in each forum, I would like to have a comma in the numbers every three spaces you know.
I know that it uses the "number_format" command, but I don't know where I need to add it.
I would also like to add it so that inside each forum the few threads that get over 1000 views or replies have the commas in them as well.
Can somebody help me with this? It seems pretty simple, but I can't find out where I need to add the "number_format" command?
Xenon
01-12-2003, 12:36 PM
in index.php for example it would be before this line:eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
before you should put this:
$forum[replycount] = number_format($forum[replycount]);
analog at the other files :)
Boofo
01-12-2003, 01:03 PM
How about for the Subscribed Threads listing in the user cp? I tried the number format for both usercp.php and member2.php and it didn't work.
Xenon
01-12-2003, 03:44 PM
boofo i think in usercp.php#
this line:$replies=$thread[replycount];
should be this:
$replies=number_format($thread[replycount]);
Xanthine
01-13-2003, 12:11 AM
Xenon the first change works on forumhomes reply count but not thread count, how would I do the threads the same?
Boofo
01-13-2003, 01:47 AM
Originally posted by Xenon
boofo i think in usercp.php#
this line:$replies=$thread[replycount];
should be this:
$replies=number_format($thread[replycount]);
I think that will work on my vb home in the user cp. It doesn't work when listing the subscribed threads listing is shown. I found it though. :) It was in the member2.php. Thanks for pointing me in the right direction. ;)
How do I add commas to the numbers for the forumdisplaybit, though? I checked the forumdisplay.php and I see nowhere to add the number_format variable.
Boofo
01-13-2003, 01:49 AM
Originally posted by Xanthine
Xenon the first change works on forumhomes reply count but not thread count, how would I do the threads the same?
Just do this for both of them:
$forum[replycount] = number_format($forum[replycount]);
$forum[threadcount] = number_format($forum[threadcount]);
Xanthine
01-13-2003, 02:51 AM
Thanks
Gutspiller
01-13-2003, 03:08 AM
Hey Xenon,
it worked part way.
I'm still trying to get it so that in the actual forum though, where a have a few threads of 1000+ replies or views. I would like those to have the commas as well. Do you know how to add it to those? I tried doing the same thing that I did with the index.php with the forumdisplay.php, but is all that did was add the commas to the same forums when you click on the catagory title in the index page of the forum.
Did that make sense?
Xenon
01-13-2003, 02:34 PM
hmm, didn't understand everything but i think you just wanted to know where to put what in forumdisplay.php right?
before this line:
eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";");
put:
$thread[views]=number_format($thread[views]);
$thread[replycount]=number_format($thread[replycount]);
Boofo
01-13-2003, 04:06 PM
Then, do we need to add this:
$forum[replycount] = number_format($forum[replycount]);
$forum[threadcount] = number_format($forum[threadcount]);
Above this, too?
eval("\$forumbits .= \"".gettemplate("forumdisplay_forumbit_level$depth$tempext")."\";");
or is that kindof redundant?
Xenon
01-13-2003, 04:55 PM
hmm, no this is just for subforums and belong to the makeforumbit function :)
Gutspiller
01-13-2003, 06:09 PM
Originally posted by Xenon
hmm, didn't understand everything but i think you just wanted to know where to put what in forumdisplay.php right?
before this line:
eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";");
put:
$thread[views]=number_format($thread[views]);
$thread[replycount]=number_format($thread[replycount]);
Yep that was it. Thanks.
Sorry to keep buggin ya. :p but I had another place I would like to add this also.
Can you tell me how I do it for getting the comma in users post counts? I have the postcount displayed of course in the postbit thingy, but I also have it displayed on the frontpage. I'm not sure if changing it in whatever one place will change both or not, but I was hoping you could help. :)
Xenon
01-13-2003, 06:43 PM
for the postbit part
you have to edit
functions.php
before this: if ($post[showemail] and $displayemails) {
eval("\$post[useremail] = \"".gettemplate("postbit_useremail")."\";");
} else {
$post[useremail]="";
}
add this:
$post[posts]=number_format($post[posts]);
for your forumhome i couldn't help, because it's a hack then and i haven't installed this one...
Gutspiller
01-13-2003, 10:14 PM
Originally posted by Xenon
for the postbit part
you have to edit
functions.php
before this: if ($post[showemail] and $displayemails) {
eval("\$post[useremail] = \"".gettemplate("postbit_useremail")."\";");
} else {
$post[useremail]="";
}
add this:
$post[posts]=number_format($post[posts]);
for your forumhome i couldn't help, because it's a hack then and i haven't installed this one...
That didn't seem to work. :(
Xenon
01-14-2003, 04:15 PM
hmm, if you haven't hacked this function it should work...
Gutspiller
01-15-2003, 11:12 PM
Originally posted by Xenon
hmm, if you haven't hacked this function it should work... I don't think I have a hacked funcitons, but I don't run the latest version of VB so that could be it. :cry:
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.