Reputation: 3809
I am trying to output a variable from F3 which contains HTML.
$message = "<p>Hello, <b>World</b></p>"
I am outputting it as follows:
<div class="container">
{{ @message }}
</div>
The problem is it displays exactly like so:
"<p>Hello, <b>World</b></p>"
Instead of just:
Hello, World
Upvotes: 2
Views: 1082
Reputation: 2660
Another solution is to disable the automatic HTML escaping.
$f3 = Base::instance();
$f3->set('ESCAPE', false);
The rendered template will look like the following:
<div class="container">
<p>Hello, <b>World</b></p>
</div>
Now it's necessary to escape untrusted data with the esc
macro. Example:
{{ @message | esc }}
See also:
Upvotes: 2
Reputation: 20737
Per their docs:
<div class="container">
{{ @message | raw }}
</div>
Upvotes: 5