You can make objects appear only if specific conditions are met.
To specify a visibility condition, insert the mn:if
attribute in the tag. These conditions can be combined using logical operators eq
, neq
, contains
, not
.
Conditions can be applied in any HTML tag where visibility conditions need to be applied.
Warning: the visibility condition cannot be applied inside an
mn:editable
<div mn:if="contact.values.GENDER eq 'M'" style="background-color:#CCFFFF;"> Special offer for men</div> <div mn:if="contact.values.GENDER eq 'F'" style="background-color:#FFCCFF;"> Special offer for women</div>
You can also use the conditions mn:else
and mn:elseif
.
These conditions must be written immediately after an if
.
<span mn:if="contact.values.gender eq 'M'">Car</span> <span mn:elseif="contact.values.gender eq 'F'">Bag</span> <span mn:else>Trip</span>
To combine multiple parameters, you can use the logical operators and
or
and parentheses.
<div mn:if="contact.values.GENDER eq 'M' and contact.values.INTEREST eq 'Cars'"> Special Sports Cars</div> <div mn:if="contact.values.GENDER eq 'F' or contact.values.INTEREST eq 'Fashion'"> Milan Fashion Week</div>