Luke G Luke G - 1 year ago 93
PHP Question

TWIG variables with HTML tags

Is it possible to pass a variable that contains HTML content to a twig template, so when the page is rendered, HTML content from the variable is interpreted, instead of displayed with tags?


$this->_app->render('test.twig', [
"description" => "<b>TEST</b>"


{{ description }}

Result from the above example:


Expected result:


Answer Source

You can use the raw filter:

{{ description|raw }}