【发布时间】:2017-01-29 13:19:06
【问题描述】:
显示内容块信息有问题
{% content 'structurated/'this.page.filename %}
这会返回一个错误。如果我删除 'structurated/' {% content this.page.filename %} 它正在工作并返回内容块。但我需要从structurated/ 文件夹返回信息。如何更改可以工作的代码?
{% content 'structurated/'this.page.filename %}
ERROR:
Unexpected token "punctuation" of value "." ("operator" expected with value "=").
==========
{% content 'structurated/'.this.page.filename %}
An exception has been thrown during the rendering of a template ("The content file '' is not found.").
==========
{% content 'structurated/'+this.page.filename %}
An exception has been thrown during the rendering of a template ("The content file '0' is not found.").
【问题讨论】:
-
请发布错误。乍一看,它不像您正确连接字符串和变量那样接缝。我不确定语法,但可能是
'structurated/'.this.page.filename或'structurated/'+this.page.filename -
我更新问题时出现错误。
-
如果你明确输入文件名会发生什么?喜欢
{% content 'structurated/my_file' %} -
如果我输入 {% content 'structurated/advertising.htm' %} 就可以了。
-
好的,所以肯定是串联。您使用的模板语法是什么?
标签: php laravel twig octobercms