• Resolved wpress2010

    (@wpress2010)


    I am trying to use an IF/ELSE conditional in a Pods template. It does not seem to work, and returns the ELSE results consistently. This is a snippet:

    [if apartment_status=”Available”]<p><span style=”font-size: inherit;”>Available on {@availdate}</span><p>

    [else] <p><span style=”font-size: inherit;”>(Currently not available.)</span>[/if]</p>

    What am I missing here? The docs show that one can use the field= shorthand, as opposed to field=”apartment_status”:

    [if field=”my_field_name” value=”5″]

    [if field=”my_field_name” value=”5″ compare=”=”]

    [if my_field_name=”5″]

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @wpress2010

    Are you sure “Available” is the actual value for this field and not it’s label? Why type of field is this?

    Cheers, Jory

    Thread Starter wpress2010

    (@wpress2010)

    It’s a relationship field – Simple (custom defined list), and the two choices are these exactly:

    1|Available
    0|Not_available

    Ach! Boolean value required!!!!!!!! So, this works:

    [if apartment_status=”1”]<p><span style=”font-size: inherit;”>Available on {@availdate}</span><p>

    [else] <p><span style=”font-size: inherit;”>(Currently not available.)</span>[/if]

    </p> Sorry for the trouble (sound of palm hitting forehead…)

    Plugin Author Jory Hogeveen

    (@keraweb)

    Haha no worries! Glad to help and that you’ve figured it out!

    You could also use a Yes/No field for this case. A simple [if field] would be sufficient then!

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘IF/ELSE in templates not working’ is closed to new replies.