Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Lowest Rated Links... any ideas?

Quote Reply
Lowest Rated Links... any ideas?
Hi:

My version of Links is showing a list of cartoons (with categories being the studios who made them), so the top rated page shows the highest rated cartoons...

I was thinking, how hard would it be to add a "Lowest Rated Cartoons" page? Obviously, it would throw out unrated, and just show those with one vote or more... or is this just a stupid idea? Any help would REALLY be appreciated!

Thanks!

Dave

Oh, if you want to see the site now:

http://www.bcdb.com/



Quote Reply
Re: Lowest Rated Links... any ideas? In reply to
Clone the "build_rate_page" sites subroutine, into "buld_lowest_page"

Change the line at the end:

open (RATE, ">$LINKS{build_ratings_path}/$LINKS{build_index}") or
die "unable to open top rated page:
$LINKS{build_ratings_path}/$LINKS{build_index}. Reason: $!";

To be

open (RATE, ">$LINKS{build_ratings_path}/Lowest_Rated.html") or
die "unable to open top rated page:
$LINKS{build_ratings_path}/Lowest_Rated.html. Reason: $!";


Reverse the SELECT statement to select the lowest rated sites.

Add a call to that subroutine at the top of nph-build.cgi after the call to the top-rated one.

Clone the subroutine in the HTML_Templates.pm for for the rate_top, and call it something like rate_low (add that to the EXPORT list at the top of the file).

Change the template call to rate_low.html

Change the cloned subroutine in the nph-build.cgi file to call the rate_low routine to build the page, rather than the rate_top.

That should do it.

You'll need to add a link to the page which should be /path/to/links/Ratings/Lowest_Rated.html


You could probably do it in one subroutine, but there are advantages to doing it this way.




http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Lowest Rated Links... any ideas? In reply to
pugdog:

I ALMOST just e-mailed you on this one.... but figured it would be better in the forum!

Thank you VERY MUCH!

Dave

Quote Reply
Re: Lowest Rated Links... any ideas? In reply to
Hi:

For those that care...

I ended up deciding that the "Lowest Rated Cartoons" would look best on the same page as highest rated...

So I just copied each bit of code down, and adding a couple new variables (I added: $ratedl, $max_rl, $min_rl, $bottom) As you edit, you will see where these all turn up.

Anyway, as Pugdog sez, just reverse the SELECT statement, add (in this case) <%bottom%> to the rate_top.html page and you are off to the races!

Oh, also, if you use it, make sure to edit page.cgi. I forgot to at first... you cannot just copy your code DIRECTLY from nph-build.cgi... you have to drop some of the code that makes it appear on the build page.

Good luck- if anyone needs help, I would be happy to lend a hand!

Oh, and to see the final page, just go to:

http://www.bcdb.com/...i?g=Ratings/&d=1

Thans again, pugdog!

Dave



Quote Reply
Re: Lowest Rated Links... any ideas? In reply to
I did _think_ about mentioning that you'd have to do the same (similar) for page.cgi, but that has not come up in so long I didn't want to confuse the issue. (Figures I'd get burned on it anyway).

page.cgi works a bit differently, but if you stare at the code for a few mintues before blindly making any changes, it starts to make sense. The logic is actually quite different. In some ways, it's more straight forward, in others, it takes a bit of thinking before you see what it's doing exactly.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/