============================================
=My Ratings amazon-image-style (Five stars)=
============================================
- My Ratings amazon-image-style mod (Five stars)(no-templates)
Author : Eduin Yesid Carrillo (yecarrillo@hotmail.com)
URL :
http://www.scoutsace.f2s.com/scripts Thread :
http://www.gossamer-threads.com/...um3/HTML/003069.html - Thanks to:
widgetz : original mod :Ratings amazon-image-style
=====================================================
links/cgi-bin/admin/links.cfg
=====================================================
Change the following codes:
Code:
# PATH and URL of What's Rating page. No Trailing slash.
$build_ratings_path = "$build_root_path/ratings";
$build_ratings_url = "$build_root_url/ratings";
to the following(change "$build_root_url/images" to the proper
location of where your images will be):
Code:
# PATH and URL of What's Rating page. No Trailing slash.
$build_ratings_path = "$build_root_path/ratings";
$build_ratings_url = "$build_root_url/ratings";
$build_ratings_images_url = "$build_root_url/images";
=====================================================
links/cgi-bin/admin/site_html.pl
=====================================================
Add this to the end of site_html.pl just before
1; line.
Change the width and the height to the size yours is going to be..
Code:
##########################################################
## Ratings amazon-image-style
##########################################################
sub get_rating_image {
# --------------------------------------------------------
# My Ratings amazon-image-style mod (Five stars)(no-templates)
# Author : Eduin Yesid Carrillo (yecarrillo@hotmail.com)
#
my ($rating,$img) = @_;
my $img1 = int($rating/2);
my $img2 = $img1 + 1;
if ($img1 - ($rating/2) == 0 ) { $img = "$img1"; }
else { $img = "$img1-$img2";}
my $image = qq~<img src="$build_images_url/rate-$img.gif" width=65 height=12 alt="$rating" border="0">~;
return $image;
}
Now, change the following codes:
Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..
my (%rec) = @_;
to the following:
Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..
my (%rec) = @_;
$rate_img = (&get_rating_image($rec{'Rating'}));
Finally, place the image of each link:
Change the following codes (sub site_html_link):
Code:
$output .= qq~ <small class="date">(Added: $rec{'Date'} Hits: $rec{'Hits'} Rating: $rec{'Rating'} Votes: $rec{'Votes'}) <a href="$build_rate_url?ID=$rec{'ID'}">Rate It</a></small>
to the following:
Code:
if ($rec{'Rating'} ne 0) { $output .= qq~ $rate_img~; }
$output .= qq~ <small class="date">(Added: $rec{'Date'} Hits: $rec{'Hits'} Votes: $rec{'Votes'}) <a href="$build_rate_url?ID=$rec{'ID'}">Rate It</a></small>
You will need to rename your images to
rate-1.gif
rate-1-2.gif
rate-2.gif
rate-2-3.gif
rate-3.gif
rate-3-4.gif
rate-4.gif
rate-4-5.gif
rate-5.gif
ok.. that's all..