Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Is there an "and/or" option for tags?

Quote Reply
Is there an "and/or" option for tags?
I have 3 custom fields - Item1, Item2 and Item3.

I'm trying to get them to work together on one line but not having much success. I can get them to work on separate lines with the following code:
<table >
<%if Item1%><tr><td><%Item1%></td></tr><%endif%>
<%if Item2%><tr><td><%Item2%></td></tr><%endif%>
<%if Item3%><tr><td><%Item3%></td></tr><%endif%>
With this code it will display any arrangement of Items e.g. 1 and 3 if there is no 2, 2 and 3 if there is no 1, etc. but when I take the table arrangement away everything changes. If there is no Item1 it won't display 2 or 3 because my tags are incorrect.

This is the sort of thing that I've tried:

<%if Item1%><%Item1%><%endif%> <%if Item2%><%Item2%><%endif%> <%if Item3%><%Item3%><%endif%>

Is there some other tag that I can use? I'm looking for something like <%andif%> or <%if Item1 and/or Item2 and/or Item3%>. I know that these aren't valid tags but it's the only way I can think of explaining it.
Quote Reply
Re: [MJB] Is there an "and/or" option for tags? In reply to
Not really sure what you are trying - but "or" and "and" are valid.

For example:

<%if field_name and other_field%>
<%elsif not field_name and other_field%>

Hope that helps.


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!