JWS
03-03-2001, 10:00 PM
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:
http://forums.maxima.org/bar_clip.gif
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:
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:
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:
width="$bar_width" height="6"
Hope this helps someone! It looks pretty neat!
Here's a sample of what it looks like:
http://forums.maxima.org/bar_clip.gif
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:
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:
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:
width="$bar_width" height="6"
Hope this helps someone! It looks pretty neat!