문제

I have an html saved in my database with a special tag string like [special_tag] and I want to display that html to my twig template at the same time replace the [special_tag] with any html elements.

Is this possible?

도움이 되었습니까?

해결책

Yes, you could use Twig's replace filter:

{{ my_variable_with_html | replace({'[special_tag]': 'new value'}) }}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top