[ic] If Else Statement

Ed LaFrance edl at newmediaems.com
Mon Oct 13 15:07:48 EDT 2003


At 01:31 PM 10/13/2003 -0700, you 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?

I would not recommend doing the following in an iterative list (like the 
results.html page, for instance), but if this is just a one-off thing, like 
on flypage.html, you can do:

[tmp field_contents][item-field category][/tmp]

[if scratch field_contents eq schwinn]
...
[elsif scratch field_contents eq mongoose]
...
[/elsif]
[elsif scratch field_contents eq something_else]
...
[/elsif]
[else]
  some other value: [scratch field_contents]
[/else]
[/if]


- Ed L.


===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          edl at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list