本文介绍了symfony2 - 树枝 - 如何从树枝模板内部渲染树枝模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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 it.The thing is that I don't know how do I call an action in the controller which I pass parameters to from my twig and call for new data and then I render the same twig template again with new parameters.
How do I do so?
解决方案
Symfony 2.1:
{% render 'YourBundle:YourController:yourAction' with {'var': value} %}
Symfony 2.6+:
{{ render(controller('YourBundle:YourController:yourAction', {'var': value})) }}
And, of course, read the documentation.
这篇关于symfony2 - 树枝 - 如何从树枝模板内部渲染树枝模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!