[英]Symfony 3 using a macro in a macro?
我想在宏中使用宏。 但這如何工作?
我的樹枝中的宏:
{% import _self as formSubmacros %} {% macro printSubcategoriesRow(SubcategoriesForm) %} <div class="the content of the subcatecories"> </div> {% endmacro %}
我在第一個宏下面編寫宏,在這里我想在其中獲得1個宏:
{% import _self as formMacros %} {% macro printCategoriesRow(CategoriesForm) %} <div class="the content of the categories with the macro subcategories"> {% for SubcategoriesForm in CategoriesForm.subcategories %} {{ formSubmacros.printSubcategoriesRow(SubcategoriesForm) }} {% endfor %} </div> {% endmacro %}
但這不起作用...
您應該將import
放入宏,以獲取適當的范圍。 如果這不起作用,請提供錯誤消息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.