Forum

Thread tagged as: Question, Problem

Perch:if with 3 conditions - help head hurts!

Hi,

I have three conditions: if Condition-A is met then image-A should be shown if Condition-B is met then image-B should be shown if neither conditions are met then Image-C should be shown

Try a lot of things including nesting the perch:if without success. At the moment I have this:

<perch:if exists="image"> <div><img src="../members/bild_symbol.png" alt="Bild" class="symbol"/></div> </perch:if> <perch:if exists="pdf-file"> <div><img src="../members/pdf_symbol.png" alt="PDF" class="symbol"/></div> </perch:if> <perch:if different="image OR pdf-file"> <div><img src="../members/text_symbol.png" alt="Text" class="symbol"/></div> </perch:if>

The text_symbol.png is not showing up though.

Can anyone help me here?

Matthew Owen

Matthew Owen 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use an else for the last clause:

<perch:if different="image OR pdf-file"><perch:else /> <div><img src="../members/text_symbol.png" alt="Text" class="symbol"/></div> </perch:if>