[ic] If Else Statement

Paul Jordan paul at gishnetwork.com
Mon Oct 13 14:59:21 EDT 2003


Anthony Minero <anthony at urbanscooters.com> wrote:
> I'm trying to do a basic if else statement. Right now I have an if
> else that returns a value if a certain field in the product database
> has any value other than "". Here's the code I used for that;
> 
> [if-item-field image_large]
> show image
> [else]
> show text
> [/else]
> [/if-item-field]
> 
> How would I get an image to show up based on what was in an item
> filed? I just want to ad a logo for the brand name of certain
> products. I'd like to do an if else statement that loaded an image
> based on what was in the category field. E.g.,
> 
> [if-item-field category == schwinn]
> show shwinn logo
> [else if-item-field category == mongoose]
> Show mongoose logo
> [else if-item-field category == gt]
> Show gt logo
> [/else]
> [/if-item-field]
> 
> Does anyone know the code I would use to accomplish this?



[if file="__IMG_DIR__/[item-field category].jpg"]

		<img src="__IMG_DIR__/vendors/[item-field category].jpg">
[else]
	show text
[/else]
[/if]

which would work if you place logos in vendors/vendorname.jpg

Alternately, you can do a lookup in another table..

vendor_info
code   vendor    logo     etc...
123    shwinn    shw.gif
124    mongoose  mng.jpg

SELECT logo WHERE  products.category = vendor_info.vendor

You know what i mean?

Paul






More information about the interchange-users mailing list