Gossamer Forum
Home : Products : Links 2.0 : Customization :

if location eq bla outputimage eq bla (Please Help)

Quote Reply
if location eq bla outputimage eq bla (Please Help)
Please check this code and let me know what I have done wrong. I have followed every logical solution that I can think of including using eq instead of <= but no luck. Just outputs a wrong image.

Here Goes:

##########################################################
## 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) = @_;

$output = qq|
< p >< a href="$build_jump_url?$db_key=$rec{$db_key}" >< img src="http://www.webrite-zw.com/images/search/bullet3.gif" width="9" height="10" alt="$rec{'Title'}" border="0" >< /a > < $font >< a href="$build_jump_url?$db_key=$rec{$db_key}">$rec{'Title'}< /a >- < /font >|;

if ($rec{'isNew'} eq "Yes") { $output .= qq| < $font_new >< i >< b >New< /b >< /i > < /font >|; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq| < $font_pop >< i >< b >Hot< /b >< /i > < /font >|; }
if ($isBest eq 1) { $output .= qq|< img src="http://www.webrite-zw.com/images/1star.jpg" alt="Editors Choice 1 Star" >|; }
elsif ($isBest eq 2) { $output .= qq| < img src="http://www.webrite-zw.com/images/2star.jpg" alt="Editors Choice 2 Stars" >|; }
elsif ($isBest eq 3) { $output .= qq| < img src="http://www.webrite-zw.com/images/3star.jpg" alt="Editors Choice 3 Stars" >|; }
elsif ($isBest eq 4) { $output .= qq| < img src="http://www.webrite-zw.com/images/4star.jpg" alt="Editors Choice 4 Stars" >|; }
elsif ($isBest eq 5) { $output .= qq| < img src="http://www.webrite-zw.com/images/5star.jpg" alt="Editors Choice 5 Stars" >|; }
else { < img src="http://www.webrite-zw.com/images/1star.jpg" alt="Editors Choice 1 Star" > }
if ($Loc <= Zimbabwe) { $output .= qq|< img src="http://www.webrite-zw.com/images/Zimbabwe.jpg" alt="Zimbabwe" >|; }
elsif ($Loc <= SAfrica) { $output .= qq| < img src="http://www.webrite-zw.com/images/SAfrica.jpg" alt="South Africa" >|; }
elsif ($Loc <= Angola) { $output .= qq| < img src="http://www.webrite-zw.com/images/Angola.jpg" alt="Angola" >|; }
elsif ($Loc <= Zambia) { $output .= qq| < img src="http://www.webrite-zw.com/images/Zambia.jpg" alt="Zambia" >|; }
elsif ($Loc <= Namibia) { $output .= qq| < img src="http://www.webrite-zw.com/images/Namibia.jpg" alt="Namibia" >|; }
elsif ($Loc <= Botswana) { $output .= qq| < img src="http://www.webrite-zw.com/images/Botswana.jpg" alt="Botswana" >|; }
elsif ($Loc <= Mozambique) { $output .= qq| < img src="http://www.webrite-zw.com/images/Mozambique.jpg" alt="Mozambique" >|; }
elsif ($Loc <= Lesotho) { $output .= qq| < img src="http://www.webrite-zw.com/images/Lesotho.jpg" alt="Lesotho">|; }
else { }
if ($rec{'Revchoice'} eq "Yes") { $output .= qq| < $font_rev >< a href="$build_review_url?$db_key=$rec{$db_key}" >< i >< b >Review< /b >< /i >< /a >< /font >\n|; }
$output .= qq| < $font_date >Rating: $rec{'Rating'} ($rec{'Votes'} Votes) [< a href="$frameit_url?url=$rec{'URL'}&$db_key=$rec{$db_key}" >Rate This Site< /a >]< /font >< br >|;
if ($rec{'Description'}) { $output .= qq| < $font >$rec{'Description'}< /font >\n|; }
$output .= qq| < $font_date >< em >(Added: $rec{'Date'}, Hits: $rec{'Hits'}) < /em >< /font >< br >< /p>|;


return $output;
}
Quote Reply
Re: if location eq bla outputimage eq bla (Please Help) In reply to
As you can see from the above it is quite tricky what I am after. If I can get this to work it would make the world of difference to what I would like to give to the world. I do appreciate you help.

Mark Gilbert
Quote Reply
Re: if location eq bla outputimage eq bla (Please Help) In reply to
Your country need to be in quotation marks:

if ($Loc eq "Zimbabwe") { $output .= qq|< img src="http://www.webrite-zw.com/images/Zimbabwe.jpg" alt="Zimbabwe" >|; }

I think that it also needs to be $rec{'Loc'} instead of $Loc (that is assuming that the $Loc field is part of your database).
Quote Reply
Re: if location eq bla outputimage eq bla (Please Help) In reply to
None of the countries are in quotes =) And you do need eq. You use mathmatical (=, <= etc. when comparing numericals, and eq, lt, gt etc when comparing strings).

Proper format would be this:

if ($Loc eq "Zimbabwe") { $output .= qq|< img src="http://www.webrite-zw.com/images/Zimbabwe.jpg" alt="Zimbabwe" >|; }

This assumes that $Loc is a field that was properly added to your database.

--Mark

------------------
You can reach my by ICQ at UID# 8602162

Quote Reply
Re: if location eq bla outputimage eq bla (Please Help) In reply to
 
Quote:
else { < img src="http://www.webrite-zw.com/images/1star.jpg" alt="Editors Choice 1 Star" > }

Shouldn't that be:

Quote:
else { $output .= qq| < img src="http://www.webrite-zw.com/images/1star.jpg" alt="Editors Choice 1 Star" >|; }


------------------
Bob Connors
bobsie@orphanage.com
www.orphanage.com/goodstuff/
goodstufflists.home.ml.org/


Quote Reply
Re: if location eq bla outputimage eq bla (Please Help) In reply to
Thanks for your help everyone...I finally managed to get it to work using

if ($rec{'Location'} eq "Zimbabwe") { $output .= qq|< img src="http://www.webrite-zw.com/images/Zimbabwe.jpg" alt="Zimbabwe" >|; }

To see the results it's on http://www.webrite-zw.com and I'm really happy I got it to work. Once again thankyou