ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

conditional on a segment

July 09, 2012 6:09pm

Subscribe [2]
  • #1 / Jul 09, 2012 6:09pm

    APGWest

    295 posts

    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

    Dan Decker

    7338 posts

    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

    APGWest

    295 posts

    I’ll take a peek at CE String, thanks!

  • #4 / Jul 12, 2012 12:25pm

    Shane Eckert

    7174 posts

    Hey Don,

    Awesome! Please let us know if that works for you!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases