Can I use a macro to show or hide a section ( like a paragraph or a set of paragraphs ) in the body on a field condition?
It's possible to show the values, but I tried to write a condition to show/hide source and it didn't work.
Here's code I inserted in the editor's html source:
<html> <head> <title></title> </head> <body> <p>{% Delivery %}</p><!-- Shows the delivery field value. Can be email or post. --> <!-- Doesn't work to check on this field to show or hide paragraphs --> {% if (Delivery = "email") { %} <p>You requested by <strong>email</strong></p> {% } %} {% if (Delivery = "post") { %} <p>You requested by <strong>post</strong></p> {% } %} </body> </html>
You need to use double equal sign:
{% if (Delivery == "email") { %}
Hi Tommy,
The main problem with the code is in the if conditions - you should use "==" instead of "=". However you don't even need to use if conditions, the following code should do the same:
<p>You requested by <strong>{% Delivery %}</strong></p>
It's true that you don't need if - conditions, but it was a simple representation of my problem. I needed to show different e-mail text based on condition. So my main problem was that I was using "=" instead of "==".
Thanks.
Please, sign in to be able to submit a new answer.