Gossamer Forum
Home : Products : Links 2.0 : Customization :

Widget's Mod Error!

Quote Reply
Widget's Mod Error!
Dear Links Users,
It seems widget's wonderful mod has a SLIGHT flaw and I can not get it to display anything other than rate0.gif no matter what the rating is! I changed the for loop to run from 1 to 20 and predictably rate1.gif was displayed. Obviously widget's code is working because it displays rate0.gif, there is just a slight flaw that is not incrementing the counter or is not referencing the Rating variable correctly.

I believe there is a step missing or something to that effect. If someone could please point me towards another image rating mod I would be very pleased, or if someone could offer a fix for the current mod I would be delighted!

For reference Widget's code is as follows:

sub get_rating_image {
my ($rating) = @_;
my ($i, $image);
for ($i = 0; $i <= 20; $i++) {
$image = qq~<img src="$rating_images_url/rate$i.gif" width="65" height="12" alt="$rating" border="0">~ and last if ($rating <= $i/2);
}
return $image || $rating;
}

This code was placed just before the 1; in the end of my site_html_templates.pl file and the code:

rate_img => &get_rating_image($rec{'Rating'}),

was placed in the %globals of site_html_templates.pl.

I have read all other posts about widget's mod and problems with it, I have spent about 3 hours on the boards now and this is my last resort. I have read all of AnthroRules information and none of it has remidied this problem, please help me out!

Quote Reply
Re: Widget's Mod Error! In reply to
In Reply To:
was placed in the %globals of site_html_templates.pl.
It won't work as a GLOBAL tag...the following codes NEEDS to go in the sub site_html_link routine:

Code:

rate_img => &get_rating_image($rec{'Rating'}),


The Rating field is ONLY defined and used in the sub site_html_link routine and thus you can ONLY use <%rate_img%> in the link.html file.


Regards,

Eliot Lee
Quote Reply
Re: Widget's Mod Error! In reply to
Thank you very much, that was exactly the problem, and I bet that's kickboxr's problem also!