Luke G Luke G - 10 months ago 81
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 }}