vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Add commas to replycounts, thread views, etc (https://vborg.vbsupport.ru/showthread.php?t=51638)

Tigga 04-14-2003 10:00 PM

Add commas to replycounts, thread views, etc
 
This "hack" is so simple I'm really surprised nobody's released it here before, or that it's not included in vB2 (though it is done this way in vB3). All this does is add commas to the number of threads & posts in each forum on your index page, and to the number of replies & views on the forum display page. So for a thread that has 1,000 views, it would normally be shown as "1000". This changes it to add the number format and show "1,000" instead. I know this is really simple, but I figured someone might find it useful since it makes those numbers a little easier to read. :)

Aaron1 04-15-2003 06:03 AM

Thanks alot!
But would a dot (point) perhaps look nicer instead of a comma?
So, if i wanted to do that, is that an easy thing to change?

Best regards,

Aaron

Velocd 04-15-2003 06:05 AM

For the moment I wasn't sure if life was worth living anymore, until I found this hack. :p

Well done.
[high]* Velocd clicks install[/high]

Tigga 04-15-2003 07:02 AM

Aaron1 - Yes, that is possible and fairly easy to do. In index.php and the first edit in forumdisplay.php, you would use this code instead:
PHP Code:

$forum[replycount]="".number_format($forum['replycount'], 0'''.');
$forum[threadcount]="".number_format($forum['threadcount'], 0'''.'); 

Then for the 2nd edit in forumdisplay.php, you would use this code instead:
PHP Code:

$thread[replycount]="".number_format($thread['replycount'], 0'''.');
$thread[views]="".number_format($thread['views'], 0'''.'); 

Velocd - Glad something so simple could help to make your life worth living. :p

Aaron1 04-15-2003 07:08 AM

Thanks!

Logician 04-15-2003 08:04 AM

Quote:

Today at 09:42 AM Tigga said this in Post #1
This "hack" is so simple I'm really surprised nobody's released it here before
That is because it has been already provided in many threads in Hack Requests forum, just like many other small and simple ("mini" as Xenon calls them) hacks .. ;)

Disturbed 04-15-2003 09:03 AM

bah i never visit general hacking forum or request forum

guess imma missing lots of cool mini hacks ;_;

Boofo 04-15-2003 11:08 AM

Don't forget the subscribed threads in the usercp. ;)

Dean C 04-15-2003 02:06 PM

Hehe for some reason i have this hack installed on my forums and for the life of me i can't remember how, why, when i did it :)

Thanks for releasing to the "Full Releases" browsing community ;) hehe

- miSt

Tigga 04-15-2003 08:15 PM

Thanks for pointing that out Boofo. I just updated the attachment to include instructions for subscribed threads too. :)

N9ne 04-15-2003 08:55 PM

And also for post counts, in postbit and member list :D

N9ne 04-15-2003 09:12 PM

For post counts in postbit, put this code anywhere in the buildpostbit function in functions.php

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

N9ne 04-15-2003 09:15 PM

And for memberlist post counts:

memberlist.php, find:

$userinfo[datejoined]=vbdate($dateformat,$userinfo[joindate]);

Below it, add:

$userinfo[posts]=number_format($userinfo[posts]);

Done.

Thanks for the hack Tigga :)

Logik 04-15-2003 10:15 PM

Nice addition. :)

VAN 05-04-2003 08:20 PM

Doh! Found another...

To add this to the post counts in a users profile,

In member.php find:

$userinfo[datejoined]=vbdate($dateformat,$userinfo[joindate]);

Below that, add:

$userinfo[posts]=number_format($userinfo[posts]);

Thanks for the "mini-hack", Tigga.

::installs original + everyones add-ons::

Boofo 05-04-2003 09:05 PM

Tigga, in your instructions, shouldn't this:

PHP Code:

Now open usercp.php AND member2.php and look for:

$replies=$thread[replycount];
$views=$thread[views];


Change that to (in both files):

$thread[replycount]=number_format($thread[replycount]);
$thread[views]=number_format($thread[views]); 

actually be this:

PHP Code:

Now open usercp.php AND member2.php and look for:

$replies=$thread[replycount];
$views=$thread[views];


Change that to (in both files):

$replies=number_format($thread[replycount]);
$views=number_format($thread[views]); 


Tigga 05-04-2003 10:13 PM

Bofo - No, actually the code you're looking for in those 2 files is useless. The $replies and $views variables aren't used anywhere in the templates, so I'm not sure why the code is even there in the first place (other than the devs forgot to remove it). That's why I figured it best to trade out that code for something a little more useful. ;)

Boofo 05-04-2003 10:53 PM

I just checked the templates. You're right. I don't see those anywhere at all. Thanks for clearing that up. ;)

BTW: It's Boofo, not Bofo. ;)

Tigga 05-04-2003 10:57 PM

No problem at all. I thought it was kinda strange that the code was in there as well and made sure it wasn't used anywhere first. Maybe they were planning on using the number_format tags at first and forgot about it? Who knows...
Sorry about the typo in your name. Guess I was typing a little too fast. ;)

Boofo 05-04-2003 11:10 PM

I would tend to believe it is just forgotten code. ;)

BTW: Did you get the pm I sent you?

?????p?x???? 08-13-2003 06:11 AM

Splendid. Much more professional looking. :-)


All times are GMT. The time now is 04:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01107 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete