Twig template engine (php)

Please tell me, I work with a twig template. I pass a table row as a variable in this form:

...........................
while ($rows=$db->fetchAssoc($monterData))
        {
        $content.="<tr><td>$rows[monter_name]</td><td></td></tr>";
        }                   
     ........................ 
      $template->display(array('datacontent'=>$content));?>

and the template is just a table:

{% include 'header.html' %}
<div id="main" class="body">
         <table>
     {{datacontent}}
     </table>
</div>   
{% include 'footer.html'  %}

I don’t insert lines, but output them separately
:

<div class="body" id="main">
  /tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[]&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
     <table></table>
</div>

Why is that?


Answer 1, authority 100%

Try writing in a template

{% autoescape false %}
{{datacontent}}
{% endautoescape %}

In earlier versions (according to the documentation it should have worked:

{{ datacontent|safe }}

But now the safefilter is somehow missing from the twig distribution

In general, the example you gave is from the category of how not to do it. It is more correct to transfer all table generation to the template, and to transfer only data to twig