Gossamer Forum
Home : Products : Links 2.0 : Customization :

How do I add star ratings to directory listings? Thanks

Quote Reply
How do I add star ratings to directory listings? Thanks
How do I add star ratings to directory listings? Thanks
Gene99
Quote Reply
Re: [gene99] How do I add star ratings to directory listings? Thanks In reply to
Hi,

This is based off one that was posted a while back, but the page with instructions on was lost.

Here they are:

1) Open /cgi-bin/links/admin/site_html_link.pl , and find:

Code:
sub site_html_link {

.... other code here

}

Replace this with:

Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.

my %rec = @_;

$img_loc = q|http://www.location_of_Picture.com/images|;

$rating = qq|<img src="$img_loc/5star.gif">| if ($rec{'Rating'}=~ /^10/);
$rating = qq|<img src="$img_loc/45star.gif"> | if ($rec{'Rating'} =~ /^9/);
$rating = qq|<img src="$img_loc/4star.gif"> | if ($rec{'Rating'} =~ /^8/);
$rating = qq|<img src="$img_loc/35star.gif"> | if ($rec{'Rating'} =~ /^7/);
$rating = qq|<img src="$img_loc/3star.gif"> | if ($rec{'Rating'} =~ /^6/);
$rating = qq|<img src="$img_loc/25star.gif"> | if ($rec{'Rating'} =~ /^5/);
$rating = qq|<img src="$img_loc/2star.gif"> | if ($rec{'Rating'} =~ /^4/);
$rating = qq|<img src="$img_loc/15star.gif"> | if ($rec{'Rating'} =~ /^3/);
$rating = qq|<img src="$img_loc/1star.gif"> | if ($rec{'Rating'} =~ /^2/);
$rating = qq|<img src="$img_loc/05star.gif"> | if ($rec{'Rating'} =~ /^1$|^1\./);
$rating = qq|<img src="$img_loc/0star.gif" width="75" height="15">| if ($rec{'Rating'} < 1);

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

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


NOTE: BE sure to edit this line, so match up with your image folder:

Code:
$img_loc = q|http://www.location_of_Picture.com/images|;

2) Download the attached img.zip file, and upload the contents to your site (ideally the /images folder).

3) Open up the template link.html , and add in <%rate_img%> whereever you want the rating image to show :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!