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| |$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
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| |$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