出于某种原因,设置一个变量来表示一个文件路径,然后使用它来嵌入是行不通的。有人知道原因吗?
这工作:
{% embed 'Console::components/somecomponent' with {} only %}
{% endembed %}
但这并不是:
{% set abc = 'Console::components/somecomponent' %}
{% embed abc with {} only %}
{% endembed %}
以上返回以下错误:
第5行的“xxxxxx”中不存在变量“abc”。
但另一方面,具有讽刺意味的是,“包含”的作用似乎如下:
{% set abc = 'Console::components/anothercomponent' %}
{% include abc with {} only %}
如果有人能给我点启示,我将不胜感激。
谢谢!