从多个孩子的symfony延伸

时间:2015-10-19 11:39:22

标签: symfony twig

我有一个带有基本html的base.html.twig。

在&#39;基地&#39;我有var Counter = angular .Component({ selector: 'counter', template: '<h2>Hello counter</h2>' }) .Class({ constructor: function () {} }); var AppComponent = angular .Component({ selector: 'my-app', directives: [Counter], // <-- Here we are! template: '<h1>Counters</h1><counter></counter>' }) .Class({ constructor: function () { } }); angular.bootstrap(AppComponent); {% block body %}{% endblock %}

我打电话给&#39; form.html.twig&#39;来自Controller的文件和模板扩展了base.html.twig。

&#39;表格&#39;包含{% block javascript %}{% endblock %}<form>标记,可以包含随机数量的子模板/表单元素:

</form>

&#39;模板&#39;可能是customer.html.twig,confirm.html.twig,vehicle.html.twig等等。他们现在都有'{% block body %} {% for template in templates %} {% embed template %}{% endembed %} {% endfor %} {% endblock %}' {% block body %} - 这个问题

模板文件中的内容未移至block body / javascript。如何通过twig / symfony将模板文件中的内容移动到&quot; base.html.twig&#39;中的相应区域?

感谢您的时间。

1 个答案:

答案 0 :(得分:0)

您希望使用use twig标记而不是embed标记

 {% use template %}

在此处查看更多信息:

http://twig.sensiolabs.org/doc/tags/use.html