Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2/Twig - Need to use |nl2br for spaces and |raw blog body in twig, can this be done?

Tags:

twig

symfony

I am using nl2br filter on the blog body to put in spaces. Is it possible to also use another filter on top of this? I would like to use |raw for some html code in the blog body.

e.g., how can I add in the |raw filter on top of this?

{% for blogs in blog %}
   <p>{{ blog.blog|nl2br }}</p>
{% endfor %}
like image 357
dizzyd Avatar asked Dec 09 '22 08:12

dizzyd


1 Answers

You can use your filters in chain, so:

{{ blog.blog|raw|nl2br }}
like image 116
Tomasz Madeyski Avatar answered Dec 10 '22 21:12

Tomasz Madeyski