Html Content become encoded inside if condition

L B asked on September 20, 2018 10:56

Hi,

kentico version: v11.0.21

We encounter an issue with macro condition within an email template somehow the content become encoded, I'm probably not the first one to end in this issue, sooo HELP :)

Here is a sample of the problem,

Template:

<div>aaa</div><br>
{% if (test) { %}
<div>test</div>
{% } #%}
<div>aaa</div><br>

Code

macroResolver.SetNamedSourceData("test", true);

Result

aaa
<div>test</div>
aaa

So the div between the if statement is HtmlEncoded while the rest is not, I did read about |encode(false) but this is for the internal content of a macro, here I'm out.

Any idea ?

Correct Answer

Dragoljub Ilic answered on September 20, 2018 11:12

Hi,

Did you tried to set encode to false when you end if statement? Something like this:

<div>aaa</div><br>
{% if (test) { %}
<div>test</div>
{%}|(encode)false|(identity)GlobalAdministrator%}
<div>aaa</div><br>

Best regards, Dragoljub

3 votesVote for this answer Unmark Correct answer

Recent Answers


L B answered on September 20, 2018 11:48

Thanks, it is the correct answer, I guess it make sense even if it is definitely weird ^^

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.