我们知道,{% include header.volt %}是名为header.volt的引用文件。
如何在volt模板中动态引用模板文件?
就像这样:
{% include variable %}
when variable equal `footer.volt`, theen the program will reference file with name's `footer.volt` when variable equal `index.volt`, then the program will reference file with name's `index.volt`... 谢谢!
发布于 2013-11-07 09:33:39
我不确定是否可以在include中使用变量,但您可以始终使用partial()来包含模板:
{% set partialName = 'footer' %}
{{ partial('partials/'~partialName) }}https://stackoverflow.com/questions/19827002
复制相似问题