We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    I'm using the If snippet to check placeholders, one at a time. Works great.

    Now I need to check an array of 3 placeholders, and only if all 3 are empty return a message. Looking at the If docs I understand the basic idea of the array example, but what I can't figure out is how to ensure all 3 placeholders are empty (instead of either/or) before printing my "empty message".
    [[If?
       &subject=`[[*id]]`
       &operator=`inarray`
       &operand=`6,11,12`
       &then=`Show this if all 3 are empty`
       &else=``
    ]]

    This question has been answered by multiple community members. See the first response.

      Todd
    • discuss.answer
      • 6629
      • 60 Posts
      [[If?
          &subject=`[[*placeholder-1]][[*placeholder-2]][[*placeholder-3]]`
          &operator=`empty`
          &then=`Show this if all 3 are empty`
          &else=``
      ]]
        • 12893
        • 13 Posts
        I'm trying to use the If extra to identify words in a text array, but I find that it only works for numbers. How can I solve this problem?

        For example:

        [[!If?
           &subject=`birds`
           &operator=`inarray`
           &operand=`dogs, birds, cats`
           &then=`Birds`
           &else=`No birds`
        ]]
        • discuss.answer
          • 12893
          • 13 Posts
          I solved my own question, it's possible to use the ifEval add-on instead to utilize "strpos" like this:

          [[!ifEval? &input=`stripos("dogs, birds, cats", "birds")  !== false` &contentTrue=`Birds` &contentFalse=`No birds`]]


          Quote from: ineffable at Jun 02, 2015, 08:26 PM
          I'm trying to use the If extra to identify words in a text array, but I find that it only works for numbers. How can I solve this problem?

          For example:

          [[!If?
             &subject=`birds`
             &operator=`inarray`
             &operand=`dogs, birds, cats`
             &then=`Birds`
             &else=`No birds`
          ]]