您好,我如何將一個數組傳遞給一個樹枝包括?如何從數組中包含樹枝文件?
{% set navbar_logo %}["{{sprinkle|raw}}/components/content/navbar/navbar-logo.html.twig", "/components/content/navbar/navbar-logo.html.twig"]{% endset %}
{% include navbar_logo %}
這導致:
Unable to find template "["@admin/components/content/navbar/navbar-logo.html.twig", "/components/content/navbar/navbar-logo.html.twig"]"
這工作得很好:
{% include ["{{sprinkle|raw}}/components/content/navbar/navbar-logo.html.twig", "/components/content/navbar/navbar-logo.html.twig"] %}
,但我需要從變量得到它。
這也適用於:
{% set navbar_logo %}{{sprinkle|raw}}/components/content/navbar/navbar-logo.html.twig{% endset %}
{% include navbar_logo %}
但我需要備份櫃面第一個不存在。 我該怎麼做?