Gossamer Forum
Quote Reply
Rating mod
I converted the rating mod posted by "widgetz" for use in LinksSQL

Here it goes:

Add this to the end of your HTML_Templates.pm..
sub get_rating_image {
my ($rating) = @_;
my ($i, $image);
for ($i = 0; $i <= 20; $i++) {
$image = qq|<img src="$LINKS{rating_images_url}/rate$i.gif" width="102" height="18" alt="$rating" border="0" align="absmiddle">| and last if ($rating <= $i/2);
}
return $image&#0124; &#0124;$rating;
}

Add &get_rating_image to your @EXPORT in your HTML_Templates.pm

In your Links.pm, add the following
$LINKS{rating_images_url} = "$LINKS{build_root_url}/Ratings";
After this $LINKS{build_ratings_url} = "$LINKS{build_root_url}/Ratings";

In your HTML_Templates.pm site_html_link subroutine, change this:

return &load_template ('link.html', {
detailed_url => "$LINKS{db_detailed_url}/${$rec}{'ID'}$LINKS{build_extension}",
%$rec,
%globals
});

To read:

return &load_template ('link.html', {
rate_img => &get_rating_image($rec->{'Rating'}),
detailed_url => "$LINKS{db_detailed_url}/${$rec}{'ID'}$LINKS{build_extension}",
%$rec,
%globals
});

Thats it, just upload your images to the dir you specified above and name them rate0.gif - rate20.gif
Quote Reply
Re: Rating mod In reply to
hehe.. ok...

review.cgi v2 was suppose to come out with this mod.. oh well.. also.. it's not the same as this.. i made a different one..

jerry
Quote Reply
Re: Rating mod In reply to
I was looking at review.cgi earlier...nice.
Has it been converted for LinksSQL yet?