2016-12-13 2 views
-1

with 키워드로 일부 html을 전달하면서 다른 html.twig 파일을 포함하려는 .html.twig 파일이 있습니다. 문제는 그것이 HTML이지만 일반 텍스트로 렌더링되지 않는다는 것입니다. 예 :나뭇 가지 안에 'html이있는'나뭇 가지를 포함합니다.

#base.html.twig 
<div> 
    Some content ... 
    {% include 'AppBundle::partials/speech-bubble.html.twig' with {'text': "This is <br/> HTML content"} %} 
<div> 

#speech-bubble.html.twig 
<div class="speechbubble-wrapper"> 
    <div class="speechbubble-text"> 
    {{ text }} 
    </div> 
</div> 

문제는 대신 결과에 있다는 것입니다 :

이것은
HTML 콘텐츠를 내가 볼

This is <br/> HTML content 
+1

'{{text | raw}}'이스케이프를 막기 위해'raw' 필터를 사용해야합니다. – DarkBee

답변

1

@DarkBee 댓글을 달았으로 , 원본 필터를 사용하여 텍스트를 p 흠집 : {{ text | raw }}. 고맙습니다!

관련 문제