如何在.twig文件中初始化函数?
localhost/firstAngularProject
该功能如何成为.twig格式? 像那样:
<?php function renderCategories($categories, $selected, $button_edit, $column_sort_order, $column_name, $column_action) { ?>
function body..
<?php } ?>
但是如何设置功能结束?
答案 0 :(得分:3)
最佳解决方案恕我直言是创建一个宏:
L = [(x, list(i)) for x, y in df[['Type','list_dates']].values
for i in list(itertools.combinations(y,2))]
定义宏后,您可以使用它:
{# macros.html.twig #}
{% macro renderCategories(categories, selected, button_edit, column_sort_order, column_name, column_action) %}
{# then here goes the body of your macro HTML and loops... #}
{% endmacro %}