Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render twig-template with dynamically placed HTML in Symfony2?

Tags:

php

twig

symfony

I have an action and a Twig-template.

Via render() it is possible to place a text for a Twig-tag {{ tagname }}.

But this text is escaped. Now I would like to place (not-escaped) HTML-code.

How is that done in Symfony2?

like image 210
Raffael Avatar asked Nov 29 '22 16:11

Raffael


1 Answers

Escaping is handled by Twig.

{{ var }} leads to escaped output.

{{ var|raw }} leads to raw/not-escaped output.

raw is a filter.

like image 126
Raffael Avatar answered Dec 04 '22 08:12

Raffael