Gossamer Forum
Home : Products : Gossamer Links : Discussions :

An IF statement matching string with "and"

Quote Reply
An IF statement matching string with "and"
Hi:

I have been modifying some templates recently to put specific show logo's in with that show's (only!) pages. Pretty easy with an if-elseif-else cde like this:

Code:


<%if title like 'Walt Disney Studios: Television: The Goliath Chronicles'%>

<IMG SRC="/images/disney/logo/goliath_chron.jpg" ALT="Gargoyles: The Goliath Chronicles Episode Guide- Disney TV" BORDER=5 WIDTH=225 HEIGHT=151>

<%elseif title like 'Walt Disney Studios: Television: Gargoyles'%>

<IMG SRC="/images/disney/logo/Gargoyles.jpg" ALT="Gargoyles Cartoon Episode Guide- Disney TV" BORDER=5 WIDTH=225 HEIGHT=151>

<%elseif title like 'Walt Disney Studios: Television: Disney's Kim Possible'%>

<IMG SRC="/images/disney/logo/kim_possible.jpg" ALT="Kim Possible Cartoon Episode Guide- Disney TV" BORDER=5 WIDTH=225 HEIGHT=151>



....




However, I noticed this failing in a few instances. For instance, this will not work:

Code:


<%elseif title like 'Walt Disney Studios: Television: The Shnookums and Meat Funny Cartoon Show'%>

<IMG SRC="/images/disney/logo/shnookems_meat.jpg" ALT="The Shnookums and Meat Funny Cartoon Show Episode Guide- Disney TV" BORDER=5 WIDTH=225 HEIGHT=151>


even though "The Shnookums and Meat Funny Cartoon Show" is a valid category name.

Played around, and discovered it was the word "and" in the like match statement. The following DOES work:

Code:


<%elseif title like 'Walt Disney Studios: Television: The Shnookums'%>

<IMG SRC="/images/disney/logo/shnookems_meat.jpg" ALT="The Shnookums and Meat Funny Cartoon Show Episode Guide- Disney TV" BORDER=5 WIDTH=225 HEIGHT=151>


(and, since "shnookums" is such an unusual word, it will work fine in this instance)

So, anyway, I just wanted to point that out- if anyone is having problems matching category names like this, look for an "and"!


dave

Big Cartoon DataBase
Big Comic Book DataBase