簡體   English   中英

Symfony 3在宏中使用宏?

[英]Symfony 3 using a macro in a macro?

我想在宏中使用宏。 但這如何工作?

  1. 我的樹枝中的宏:

      {% import _self as formSubmacros %} {% macro printSubcategoriesRow(SubcategoriesForm) %} <div class="the content of the subcatecories"> </div> {% endmacro %} 
  2. 我在第一個宏下面編寫宏,在這里我想在其中獲得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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM