Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Conditional for "Contains"

Quote Reply
Conditional for "Contains"

I can use conditionals in my templates like:

<%if State eq 'California'%>

However, is there any conditional that would check if a field contains a phrase rather than being exactly equal to it? For example if the State field included: 'California, Nevada, Arizona' I would like to set up a conditional that would check the following:

<%if State "contains" 'Nevada'%>

Is there an operator similar to 'eq' that would work in place of "contains" above if the field contained the parameter rather than being exactly equal to it?

Any help would be much appreciated...


Quote Reply
Re: Conditional for "Contains" In reply to
Have a look at /admin/admin.cgido=help&topic=/GT/Template.html.

Your best bet is to write a simple function, and include it via a module or global. You can access the variables as shown in the document, and then get perl to spit out some variables using a simple script.