Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
Details »»

Version: , by JWS JWS is offline
Developer Last Online: Jul 2002 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-03-2001 Last Update: Never Installs: 0
 
No support by the author.

This hack will let you have a bargraph to show ratings of threads instead of stars. In addition, it doesn't round to whole numbers and the bargraph shows smaller increments as a result.

Here's a sample of what it looks like:



The gist of it is this: take the average rating value (say 2.45), round it off to 1 decimal of precision (i.e. 2.4) and multiply by 10 (to get "24"). Now the width of the bargraph is set to 24 pixels wide.

The image included as an attachment is a 1x6 image that stretches without getting distorted. You could make your own image or make variations of the image to get different results.

Basically, you need to change the following:

In forumdisplay.php around line 377, you'll see:

Code:
if ($foruminfo[allowratings]) {
         if ($thread[votenum] >= $showvotes && $thread[votenum] != 0) {
            $rating = intval(round($thread[voteavg]));
            $thread[rating] = $rating . 'stars.gif';
         } else {
            $thread[rating] = 'clear.gif';
         }
Change this to:
Code:
if ($foruminfo[allowratings]) {
         if ($thread[votenum] >= $showvotes && $thread[votenum] != 0) {
            $rating = round($thread[voteavg],1);
            $bar_width = $rating * 10;
            $thread[rating] = 'bar.gif';
         } else {
            $thread[rating] = 'clear.gif';
         }
Then in the forumdisplaybit_threadrate template, add the following parameters to the SRC tag of the image:
Code:
width="$bar_width" height="6"
Hope this helps someone! It looks pretty neat!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-03-2001, 11:52 PM
Guest
 
Posts: n/a
Default

Cool! I was going to change teh star*.gif's from stars to a bar of different lengths, i think i'll use your way, this way i can rate threads from 1-10 instead of 1-5 and the page will load faster, as it only loads one very small gif, not 10 big gifs! nice job
Reply With Quote
  #3  
Old 03-03-2001, 11:54 PM
Guest
 
Posts: n/a
Default

Glad you like it. Just keep in mind that you'll need to widen the <td> width of the column for the ratings if you go up to 10. Other than that, you should be good to go!

Quote:
Originally posted by Joe
Cool! I was going to change teh star*.gif's from stars to a bar of different lengths, i think i'll use your way, this way i can rate threads from 1-10 instead of 1-5 and the page will load faster, as it only loads one very small gif, not 10 big gifs! nice job
Reply With Quote
  #4  
Old 03-03-2001, 11:58 PM
Guest
 
Posts: n/a
Default

Couldnt i just times the gif size by 5, instead of 10? Maybe i will stick to a 5 choice rating *shrug* i'll have to think about it .
Reply With Quote
  #5  
Old 03-04-2001, 12:03 AM
Guest
 
Posts: n/a
Default

No, because the "*10" gets the decimal into the ones place so that you can set the width. Doing it by 5 would just get you another decimal possibly and you can't set a width to a decimal place.

Just make sure that the table cell width coincides with how big you're making your bar and you'll be fine.

Quote:
Originally posted by Joe
Couldnt i just times the gif size by 5, instead of 10? Maybe i will stick to a 5 choice rating *shrug* i'll have to think about it .
Reply With Quote
  #6  
Old 03-04-2001, 12:05 AM
Guest
 
Posts: n/a
Default

ahh, thanks heh
Reply With Quote
  #7  
Old 03-04-2001, 12:11 AM
Guest
 
Posts: n/a
Default

thx man. great job
Reply With Quote
  #8  
Old 08-05-2001, 02:03 PM
ThomasP
Guest
 
Posts: n/a
Default

Thanks JWS,

works very well on 2.0.3.

It's around 451 in 2.0.3 and here are the slightly different changes:

Find:
PHP Code:
      if ($foruminfo[allowratings]) {
         if (
$thread[votenum] >= $showvotes) {
            
$rating intval(round($thread[voteavg]));
            
$thread[rating] = $rating 'stars.gif';
         } else {
            
$thread[rating] = 'clear.gif';
         } 
Change to:
PHP Code:
if ($foruminfo[allowratings]) {
         if (
$thread[votenum] >= $showvotes) {
            
$rating round($thread[voteavg],1);
            
$bar_width $rating 10;
            
$thread[rating] = 'bar.gif';
         } else {
            
$thread[rating] = 'clear.gif';
         } 
cu,
-Tom
Reply With Quote
  #9  
Old 08-05-2001, 04:20 PM
JamesUS's Avatar
JamesUS JamesUS is offline
 
Join Date: Oct 2001
Posts: 347
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Moved into the releases forum for you
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07349 seconds
  • Memory Usage 2,267KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (2)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete