I'm having trouble rendering a string into HTML tags. This happens to me when using a form, which previews the data after submitting it, but the problem is that it doesn't interpret the HTML tags, it simply shows them to me.
I pass the variable to twig like this:
return $this->render('registro/index.html.twig', array(
'articulo' => $producto->getArticleHtml(),
));
$producto
It is nothing more than the instance of an entity that I have previously declared, so that later I can upload it to the database.
I visualize it this way in twig:
<p>{{ articulo }}</p>
Am I forgetting something? It is the first time that I work with Symfony and this with pure PHP (without using any framework) worked for me without any problem.
Example of how it is displayed, with labels included:
<b>Esto es una prueba</b>
If you use template
Twig
output escaping is enabled by default. If you want to disable it you can do it withraw
, as the documentation says :Following these guidelines, your code should work if you do this: