We all know you can do an IF on a segment for an exact match, but what about if the segment includes X? I’m hoping for something like:
{if segment_2 LIKE 'shoe'}something{/if}So if segment 2 was ‘green-shoes’, it would return true. Possible?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 09, 2012 6:09pm
Subscribe [2]#1 / Jul 09, 2012 6:09pm
We all know you can do an IF on a segment for an exact match, but what about if the segment includes X? I’m hoping for something like:
{if segment_2 LIKE 'shoe'}something{/if}So if segment 2 was ‘green-shoes’, it would return true. Possible?
#2 / Jul 11, 2012 11:19am
Hi Don,
ExpressionEngine uses conditional operators, LIKE is more of a SQL operator. So, natively, no, it’s not possible.
However, you can open up EE’s string comparison abilities with CE String. It brings most of PHP’s string functions into an ExpressionEngine plugin.
Cheers,
#3 / Jul 11, 2012 11:49am
I’ll take a peek at CE String, thanks!
#4 / Jul 12, 2012 12:25pm
Hey Don,
Awesome! Please let us know if that works for you!
Cheers,