Gossamer Forum
Home : Products : Links 2.0 : Customization :

Need a if/then for the 'STAR' rating if link under 10 votes. Look inside!

Quote Reply
Need a if/then for the 'STAR' rating if link under 10 votes. Look inside!
Hey all,

I am using the 'star' rating system instead of the 9.5 numeric style.

What I am curious is this, is there an easy way to put an 'if/then' statement in here so that if the 'link' has less that '10' votes, it will show the 1st image, which I have set up as blank.

This way a site that has one vote of "10" does not get a 5 start rating.

I made horses for my 5 stars, since my site is a Ford Mustang site, if anyone desires those let me know.

Below is the code, just looking for an easy if then.

Thanks
Mike

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) = @_;
my $rate_img = "";

$rate_00 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate00.gif" WIDTH=160 HEIGHT=16 ALT="Rate It!" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_01 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate01.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_02 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate02.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_03 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate03.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_04 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate04.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_05 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate05.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_06 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate06.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_07 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate07.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_08 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate08.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_09 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate09.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_10 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate10.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_11 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate11.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_12 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate12.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_13 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate13.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_14 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate14.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_15 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate15.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_16 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate16.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_17 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate17.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_18 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate18.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_19 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate19.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_20 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate20.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;


if ($rec{'Rating'} eq '10.00') { $rate_img = $rate_20; }
elsif ($rec{'Rating'} eq '0') { $rate_img = $rate_00; }
elsif ($rec{'Rating'} le '0.50') { $rate_img = $rate_01; }
elsif ($rec{'Rating'} le '1.00') { $rate_img = $rate_02; }
elsif ($rec{'Rating'} le '1.50') { $rate_img = $rate_03; }
elsif ($rec{'Rating'} le '2.00') { $rate_img = $rate_04; }
elsif ($rec{'Rating'} le '2.50') { $rate_img = $rate_05; }
elsif ($rec{'Rating'} le '3.00') { $rate_img = $rate_06; }
elsif ($rec{'Rating'} le '3.50') { $rate_img = $rate_07; }
elsif ($rec{'Rating'} le '4.00') { $rate_img = $rate_08; }
elsif ($rec{'Rating'} le '4.50') { $rate_img = $rate_09; }
elsif ($rec{'Rating'} le '5.00') { $rate_img = $rate_10; }
elsif ($rec{'Rating'} le '5.50') { $rate_img = $rate_11; }
elsif ($rec{'Rating'} le '6.00') { $rate_img = $rate_12; }
elsif ($rec{'Rating'} le '6.50') { $rate_img = $rate_13; }
elsif ($rec{'Rating'} le '7.00') { $rate_img = $rate_14; }
elsif ($rec{'Rating'} le '7.50') { $rate_img = $rate_15; }
elsif ($rec{'Rating'} le '8.00') { $rate_img = $rate_16; }
elsif ($rec{'Rating'} le '8.50') { $rate_img = $rate_17; }
elsif ($rec{'Rating'} le '9.00') { $rate_img = $rate_18; }
elsif ($rec{'Rating'} le '9.50') { $rate_img = $rate_19; }
else { $rate_img = $rate_20; }

And then I call it with '$rate_img'.



Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
OK,

Now I am baffled... why in Netscape is my whole Link and descript, etc. underlined.

here is the code, and everything looks closed.. ?????

Code:
<table width="500" bgcolor="#ffffff" cellspacing="0" cellpadding="5"
bordercolor="#000000">

<tr>
<td width="100%"><a href="http://stangnet.com/links2/jump.cgi?ID=724"><font face=tahoma,verdana size=2><b>Chris' Car Site</b></a> <a href="http://stangnet.com/links2/rate.cgi?ID=724"><IMG SRC="/images/rate00.gif" WIDTH=160 HEIGHT=16 ALT="Rate It!" BORDER="0" ALIGN="ABSMIDDLE"></A> <br><font face=tahoma,verdana size=2> Hundreds of cars with multimedia for each!
<br><small class="date"><b>(Added:</b> 27-May-1999 <b>Hits:</b> 37 <b> )</b> [<a href="http://stangnet.com/links2/rate.cgi?ID=724">Rate It!</a>] [<a class="link" href="http://stangnet.com/links2/send.cgi?ID=724">Email this Link</a>]<br> </small>
</td>
</tr>
</table>

Mike

Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
LOL Smile

I found it, freakin didnt close a FONT tag.

NETSCAPE is ticky! Smile

Mike
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
It seems to me (I haven't tried this) that the easiest way to do this would be
Code:
if ($rec{'Votes'} > 1) {
if ($rec{'Rating'} eq '10.00') { $rate_img = $rate_20; }
...
else { $rate_img = $rate_20; }
}
else { $rate_img = $rate_00; }
I think that should work. Actually though, I'm a PERL moron, and I'm not sure whether that "if" statement ought to be ($rec{'Votes'} gt '1') but one or the other of them ought to do the trick. Replace "1" with the number of votes you want to have entered before the rating image shows up.

Hope this helps.
Phoenix



[This message has been edited by phoenix (edited June 28, 1999).]
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Thanks, that did the trick,

below is for all that use the Star rating system but do not want to give sites credit that only have one vote or so. I have it set to 10, this way only the true sites that are getting voted on show up, this way your page is not cluttered. For an example, check out www.stangnet.com in the Pony Links section.

Code:
##########################################################
## A Link ##
##########################################################

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) = @_;
my $rate_img = "";

$rate_00 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate00.gif" WIDTH=160 HEIGHT=16 ALT="Rate It!" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_01 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate01.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_02 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate02.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_03 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate03.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_04 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate04.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_05 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate05.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_06 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate06.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_07 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate07.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_08 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate08.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_09 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate09.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_10 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate10.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_11 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate11.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_12 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate12.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_13 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate13.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_14 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate14.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_15 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate15.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_16 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate16.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_17 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate17.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_18 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate18.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_19 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate19.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_20 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate20.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;


if ($rec{'Votes'} > 10) {

if ($rec{'Rating'} eq '10.00') { $rate_img = $rate_20; }
elsif ($rec{'Rating'} eq '0') { $rate_img = $rate_00; }
elsif ($rec{'Rating'} le '0.50') { $rate_img = $rate_01; }
elsif ($rec{'Rating'} le '1.00') { $rate_img = $rate_01; }
elsif ($rec{'Rating'} le '1.50') { $rate_img = $rate_01; }
elsif ($rec{'Rating'} le '2.00') { $rate_img = $rate_04; }
elsif ($rec{'Rating'} le '2.50') { $rate_img = $rate_04; }
elsif ($rec{'Rating'} le '3.00') { $rate_img = $rate_06; }
elsif ($rec{'Rating'} le '3.50') { $rate_img = $rate_06; }
elsif ($rec{'Rating'} le '4.00') { $rate_img = $rate_08; }
elsif ($rec{'Rating'} le '4.50') { $rate_img = $rate_08; }
elsif ($rec{'Rating'} le '5.00') { $rate_img = $rate_10; }
elsif ($rec{'Rating'} le '5.50') { $rate_img = $rate_10; }
elsif ($rec{'Rating'} le '6.00') { $rate_img = $rate_12; }
elsif ($rec{'Rating'} le '6.50') { $rate_img = $rate_12; }
elsif ($rec{'Rating'} le '7.00') { $rate_img = $rate_16; }
elsif ($rec{'Rating'} le '7.50') { $rate_img = $rate_16; }
elsif ($rec{'Rating'} le '8.00') { $rate_img = $rate_18; }
elsif ($rec{'Rating'} le '8.50') { $rate_img = $rate_18; }
elsif ($rec{'Rating'} le '9.00') { $rate_img = $rate_20; }
elsif ($rec{'Rating'} le '9.50') { $rate_img = $rate_20; }
else { $rate_img = $rate_20; }

}
else { $rate_img = $rate_00; }


$build_detailed ?
($output = qq~<div align="center"><center>

<table width="500" bgcolor="#ffffff" cellspacing="0" cellpadding="5"
bordercolor="#000000">

<tr>
<td width="100%"><a class="link" href="$build_jump_url?$db_key=$rec{$db_key}"><font face=tahoma,verdana size=2><b>$rec{'Title'}</b></a> $rate_img ~) :
($output = qq~<div align="center"><center>

<table border="1" width="470" bgcolor="#C0C0C0" cellspacing="0" cellpadding="5"
bordercolor="#000000">
<tr>
<td width="100%"><a class="link" href="$build_jump_url?$db_key=$rec{$db_key}"><font face=tahoma,verdana size=2><b>$rec{'Title'}</b></a>~);

if ($rec{'Description'}) { $output .= qq~ <br><span class="descript"><font face=tahoma,verdana size=2> $rec{'Description'}</span>\n~; }
if ($rec{'isNew'} eq "Yes") { $output .= qq~ <small><sup class="new">new</sup></small>~; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq~ <small><sup color="red" class="pop">HOT!</sup></small>~; }



$output .= qq~ <br><small class="date"><b>(Added:</b> $rec{'Date'} <b>Hits:</b> $rec{'Hits'} <b> )</b> [<a href="$build_rate_url?ID=$rec{'ID'}">Rate It!</a>] [<a class="link" href="$build_send_url?$db_key=$rec{$db_key}">Email this Link</a>]<br> </small>~;
if ($rec{'Detailed'} eq "Yes") { $output .= qq~ <a href="$build_detail_url/$rec{$db_key}$build_extension"><img src="/images/editors.gif" border="0" alt="Editors Pick"></a></font>~; }
$output .= qq~
</td>
</tr>
</table>
</center></div><p></P>
~;

return $output;
}

You can get the original code and graphics here...

http://www.asan.com/...nix/mod-ratings.html

On one note, I modified the script so that it ouwld show me 1/4 and 3/4 stars, to me that is to critical, looks messy on a page also, I have only whole stars, half stars and on the ones that have a crappy rating, I dont even show a star until they have like a 3.0 or better.

2nd note, this is the complete layout for a 'link' on my site, it goes in the site_html.pl, feel free to use the look.



Mike



[This message has been edited by MRaburn (edited June 28, 1999).]
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Mike,

This is unnecessarily verbose.

Since you are only using $rate_00, _01, _04, _06, _08, _10, _12, _16, _18, and _20, there is no reason not to delete the other definitions from the first part of the code (where the images are defines, before the if-else statement).

And then in the if-else statement, there is no reason to call each image you're using based on 2 different sets of parameters. Whatever the highest number is that will get a given image, leave that line and delete the ones with lower numbers. For instance leave the line with the parameter "le '1.50'" and delete the other two lines that call the same image.

This doesn't look like a very consistant visual representation. But then maybe it would make more sense if I saw your images. Smile

Phoenix
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
yeah, Smile I knew is wasnt pretty, I just changed the images in there to see if it was what I wanted. I know that I wanted to not show so many images, and I know that I should strip some lines Wink.

www.stangnet.com/links2/pages

Give it a spin. Smile

Mike

[This message has been edited by MRaburn (edited June 28, 1999).]
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Ok, here is the cleaned up script code for eveyone. Smile

Code:
##########################################################
## A Link ##
##########################################################

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) = @_;
my $rate_img = "";

$rate_00 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate00.gif" WIDTH=160 HEIGHT=16 ALT="Rate It!" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_01 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate01.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_02 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate04.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_03 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate06.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_04 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate08.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_5 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate10.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_6 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate12.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_7 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate16.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_8 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate18.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;

$rate_9 = qq|<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}"><IMG SRC="/images/rate20.gif" WIDTH=160 HEIGHT=16 ALT="Rating: $rec{'Rating'}, $rec{'Votes'} Votes" BORDER="0" ALIGN="ABSMIDDLE"></A>|;


if ($rec{'Votes'} > 10) {

if ($rec{'Rating'} eq '10.00') { $rate_img = $rate_9; }
elsif ($rec{'Rating'} eq '0') { $rate_img = $rate_00; }
elsif ($rec{'Rating'} le '1.50') { $rate_img = $rate_01; }
elsif ($rec{'Rating'} le '2.50') { $rate_img = $rate_02; }
elsif ($rec{'Rating'} le '3.50') { $rate_img = $rate_03; }
elsif ($rec{'Rating'} le '4.50') { $rate_img = $rate_04; }
elsif ($rec{'Rating'} le '5.50') { $rate_img = $rate_5; }
elsif ($rec{'Rating'} le '6.50') { $rate_img = $rate_6; }
elsif ($rec{'Rating'} le '7.50') { $rate_img = $rate_7; }
elsif ($rec{'Rating'} le '9.00') { $rate_img = $rate_8; }
else { $rate_img = $rate_9; }

}
else { $rate_img = $rate_00; }


$build_detailed ?
($output = qq~<div align="center"><center>

<table width="500" bgcolor="#ffffff" cellspacing="0" cellpadding="5"
bordercolor="#000000">

<tr>
<td width="100%"><a class="link" href="$build_jump_url?$db_key=$rec{$db_key}"><font face=tahoma,verdana size=2><b>$rec{'Title'}</b></a> $rate_img ~) :
($output = qq~<div align="center"><center>

<table border="1" width="470" bgcolor="#C0C0C0" cellspacing="0" cellpadding="5"
bordercolor="#000000">
<tr>
<td width="100%"><a class="link" href="$build_jump_url?$db_key=$rec{$db_key}"><font face=tahoma,verdana size=2><b>$rec{'Title'}</b></a>~);

if ($rec{'Description'}) { $output .= qq~ <br><span class="descript"><font face=tahoma,verdana size=2> $rec{'Description'}</span>\n~; }
if ($rec{'isNew'} eq "Yes") { $output .= qq~ <small><sup class="new">new</sup></small>~; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq~ <small><sup color="red" class="pop">HOT!</sup></small>~; }



$output .= qq~ <br><small class="date"><b>(Added:</b> $rec{'Date'} <b>Hits:</b> $rec{'Hits'} <b> )</b> [<a href="$build_rate_url?ID=$rec{'ID'}">Rate It!</a>] [<a class="link" href="$build_send_url?$db_key=$rec{$db_key}">Email this Link</a>]<br> </small>~;
if ($rec{'Detailed'} eq "Yes") { $output .= qq~ <a href="$build_detail_url/$rec{$db_key}$build_extension"><img src="/images/editors.gif" border="0" alt="Editors Pick"></a></font>~; }
$output .= qq~
</td>
</tr>
</table>
</center></div><p></P>
~;

return $output;
}

Mike
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Mike,

It looks great... the whole site. Very attractive. The only complaint I have about it is that with everything underlined on the Links pages, it's hard to see what's a links and what's plain text. Other tahn that, really sharp!

Phoenix
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Phoenix,

You in netscape??

I bet I have a tag error, let me look into that, thanks, I forgot about that.

Mike

[This message has been edited by MRaburn (edited June 28, 1999).]
Quote Reply
Re: Need a if/then for the 'STAR' rating if link under 10 votes. Look inside! In reply to
Yes, Netscape 4.5. I just looked at it in EI4 as well, and it looks great without the underlining.

Phoenix