• Resolved kendelldbest

    (@kendelldbest)


    Greetings,

    Is it possible to include multiple keywords in “contains” parameter of an if statement?

    Here’s the example that is provided in documentation: [if field=title,content contains='some keywords']

    Can I have something like? [if field=title,content contains='.mp3, .mp4']

    That way I can test scenarios like if a url entered contains a .mp4 or .mp3. I’ve tried tweaking the short-code in many different ways, but not getting any luck.

    Can you please advise?

    Thanks,
    Kendell

    • This topic was modified 3 years, 3 months ago by kendelldbest.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you tried
    [if field=title,content contains='.mp3' or field_2=title,content contains_2='.mp4']

    Thread Starter kendelldbest

    (@kendelldbest)

    Hello @polarracing,

    Thanks for your reply on this. I gave it a try but it doesn’t work.

    For some reason when I try both the way you suggested and what I did above, the if statement takes every value I am testing to be true. So even if I put mp2,mp3,mp4,mp5, it will still return true. I also try setting exact=true, but same.

    Then you could try a workaround

    [if field=title,content contains='.mp3']
      [set myvar]true[/set]
    [/if]
    [if field=title,content contains='.mp4']
      [set myvar]true[/set]
    [/if]
    [if var=myvar value=true]
    DO WHAT YOU WANT
    [/if]
    Thread Starter kendelldbest

    (@kendelldbest)

    Hi @polarracing ,

    Many Thanks. I can work with this as my solution ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘If statement contains multiple key words to test’ is closed to new replies.