Forum

Thread tagged as: Question

Multiple cases in perch:if ?

Can I test for multiple cases in '<perch if>'?

For instance, can I test for more than one ID in exists:

<perch:if exists="id_1, id_2, id_3">
     <h1>They all exist, huzzah!</h1>
</perch:if>
Jarl Robert Kristiansen

Jarl Robert Kristiansen 0 points

  • 7 years ago

Alternatively, can one nest multiple if's?

<perch:if exists="item_1">
    <perch:if exists="item_2">
        <strong>Item 1 and 2! :-)</strong>
    <perch:else>
        <strong>Item 1 only :-(</strong>
    </perch:if>
<perch:else>
   <strong>No items at all... :-(</strong>
</perch:if> 

Nesting definitely works, pretty sure multiples don't

Ah, ok great, thanks! :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Dexter is correct.