Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Rate_img error

Quote Reply
Rate_img error
Hi,
I added the global rate_img, then copy & pasted this...

sub {

#Rating as Images

my $rec = shift;

my $image = shift;

if ($rec->{'Rating'} eg '0.00') { return ; }

elsif ($rec->{'Votes'} < '10') { $image = 'rating1.gif'; }

elsif ($rec->{'Rating'} le '1.50') { $image = 'rating1.gif'; }

elsif ($rec->{'Rating'} le '2.50') { $image = 'rating2.gif'; }

elsif ($rec->{'Rating'} le '3.50') { $image = 'rating3.gif'; }

elsif ($rec->{'Rating'} le '4.50') { $image = 'rating4.gif'; }

elsif ($rec->{'Rating'} le '5.50') { $image = 'rating5.gif'; }

elsif ($rec->{'Rating'} le '6.50') { $image = 'rating6.gif'; }

elsif ($rec->{'Rating'} le '7.50') { $image = 'rating7.gif'; }

elsif ($rec->{'Rating'} le '8.50') { $image = 'rating8.gif'; }

elsif ($rec->{'Rating'} le '9.50') { $image = 'rating9.gif'; }

elsif ($rec->{'Rating'} le '10.00') { $image = 'rating10.gif'; }

else { $image = 'rating1.gif'; }

return qq|<a href="$Links::CFG->{db_cgi_url}/rate.cgi?ID=$rec->{'ID'}">

<img src="$Links::CFG->{build_images_url}/$image" border="0" alt="Rate It!" align="absmiddle"></a>|;

}

As instructed on this page,
http://gossamer-threads.com/scripts/resources/Attach/791-rateimage.html

but I keep getting this error...
A fatal error has occured:

Can't use string ("") as a subroutine ref while "strict refs" in use at user44/public_html/cgi-bin/links/cgi/admin/Links.pm line 287.


Anyone know why?
Thanks!

Quote Reply
Re: Rate_img error In reply to
I may be being silly but I don't think eg is correct (try eq) and le should be <

You know that's for Links SQL 1.1 ?


Mods:http://wiredon.net/gt/download.shtml
Installs:http://wiredon.net/gt/


Quote Reply
Re: Rate_img error In reply to
no, i didn't know that is for Links SQL 1.1. Is there a way to do it Links SQL 2.04?
Thanks.

Quote Reply
Re: Rate_img error In reply to
The DaysOld mod works much better, and I've posted some updates to it that make it work even better.

You said you are using rate_img, but you are returning the value as $image.

You might want to change $image to $rate_img so it matches your tag.

BTW: The logic for the DaysOld and Rate_Image are the same, you want to display a graphic, based on a numerical value. If I need to, I'll post a routine for Rate_image that you can add to the globals, or add to the Utils.pm (which really seems to be the best place to stick this stuff.... maybe alex will make an interface to allow us to insert template functions there)

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: Rate_img error In reply to
Hi pugdog,
Where can I find the DaysOld mod? I went to your linkssql.com site and didn't see it there.

Thanks

Quote Reply
Re: Rate_img error In reply to
Whether it is $image, $rate_img, $bobs_your_uncle or whatever makes no difference. The variable doesn't have to match the tag name. The tag is just calling the sub and the variable is returned.

Mods:http://wiredon.net/gt/download.shtml
Installs:http://wiredon.net/gt/


Quote Reply
Re: Rate_img error In reply to
Try using the code presented here. This one works as I have it running without problems (2.04)

http://www.gossamer-threads.com/...ed&sb=5&vc=1



________________________
Eraser
Insight Eye
http://www.insighteye.com