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.

if field content 'like' rather than equals - is this possible?

April 20, 2011 3:16pm

Subscribe [2]
  • #1 / Apr 20, 2011 3:16pm

    ip

    80 posts

    {if summary_field == "some-text"}
    do something
    {/if}

    is there a ‘like’ equivalent of this?

    Something like:
    {if summary_field LIKE "%some-text%"}
    do something
    {/if}

  • #2 / Apr 20, 2011 3:30pm

    Mark Bowen

    12637 posts

    I think you’d either need to use some PHP to do that or create a plugin to do the same sort of thing.

    There are a couple of plugins out there that allow you to use something like strpos but I think they just return the position at which the text occurs as opposed to if it occurs or not.

    Best wishes,

    Mark

  • #3 / Apr 20, 2011 3:34pm

    ip

    80 posts

    I found this one PHPStringFun.

    If they return a position then the text occurs!

    thanks

    ip

  • #4 / Apr 20, 2011 5:01pm

    Mark Bowen

    12637 posts

    No problem. That was actually the one I was thinking of but I wasn’t sure if it just output the position or whether there’s a conditional you can use.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases