T
T
test2018-07-06 16:38:40
symfony
test, 2018-07-06 16:38:40

PHP Simple HTML DOM output html as text on page?

Please help me figure it out, I connected the library to the project on symphony 2.8. The task is as follows:
Get the div block by id from a third-party site, and display it as html on your site.

$html = file_get_html('https://site');
         $test = $html->find('id', 0);

Further in the twig template I display this variable
{{ test }}
I get this required block, but in the form of text! Why does this happen? The browser ignores all html tags and displays them as plain text.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BoShurik, 2018-07-06
@HelmutKampfe

{{ test | raw }}

Z
zxscv, 2018-07-06
@zxscv

$test = $html->find('id', 0)->html()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question