symfony2 - twig - how to render a twig template from inside a twig template

后端 未结 3 494
醉酒成梦
醉酒成梦 2021-02-05 08:53

I have a xxx.html.twig file which shows a page, but when I want to refresh the page with different data and just update it with new data, I have a select and a submit button for

3条回答
  •  野的像风
    2021-02-05 09:43

    Here are a few different ways:

    {{ render(app.request.baseUrl ~ '/helper/test', {"hostid2": hostid } ) }}
    

    or

    {% include 'MyCoreBundle:Helper:test.html.twig' with {"hostid2": hostid } only %}
    

    or

    {% render controller("MyCoreBundle:Helper:test", {'hostid2': hostid}) %}
    

提交回复
热议问题