Gossamer Forum
Home : Products : Gossamer Links : Discussions :

If contains not working

Quote Reply
If contains not working
Hi, anyone know why this doesn't work.

Say I have a category with a full name of

Categoryword/Categoryword1/Categoryword2 Categoryword3/Categoryword4

This doesn't work

<%if Full_Name contains 'Categoryword2 Categoryword3'%>do stuff<%endif%>

But this does

<%if Full_Name contains 'Categoryword4'%>do stuff<%endif%>
Quote Reply
Re: [garrynz] If contains not working In reply to
Hi,

You may need to do;

<%if Full_Name contains 'Categoryword2_Categoryword3'%>do stuff<%endif%>

Although the space shows as an _, it may well be read with the _.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
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!
Quote Reply
Re: [Andy] If contains not working In reply to
I was meaning to put that that doesn't work either.

This is the actual code

Code:

<%~loop related_loop%>
<a href="<%URL%>"><%if Full_Name contains 'Bed_and_Breakfast'%>Bed and Breakfast</a><%endif%>
<%~endloop%>

but this works

<%~loop related_loop%>
<a href="<%URL%>"><%if Full_Name contains 'Sometown'%>Bed and Breakfasts</a><%endif%>
<%~endloop%>

where the category structure is Country/Bed_and_Breakfast/Sometown
Quote Reply
Re: [garrynz] If contains not working In reply to
Hi,

I see your problem =)

Try doing a <%GT::Template::dump%> call inside the <%loop .. %> part, and see if there is a Related_Full_Name value, or similar.

Basically, you're going through the related_loop, but this doesn't hold the Full_Name, AFAIK. I'm not really sure of a way around it though :/

Cheers

Andy (mod)
andy@ultranerds.co.uk
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!
Quote Reply
Re: [Andy] If contains not working In reply to
Thanks Andy, Full_Name is dumped out but it doesn't contain any underscores seperating the words . I changed it to <%if URL contains 'Bed_and_Breakfast'%> and that works ok. Thanks again.