2017-01-29 69 views
0

有问题显示内容块的信息Laravel在{%含量%}显示信息

{% 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."). 
+0

请张贴错误。乍一看,它不像缝合串和你的变量一样。我不知道的语法,但可能''structurated /'this.page.filename'或''structurated /'+ this.page.filename' –

+0

我更新错误的问题。 –

+0

如果您明确输入文件名,会发生什么情况?像'{%content'structurated/my_file'%}' –

回答

1

这应该这样做。

{% content 'structurated/' ~ this.page.filename %} 

它现在没有被正确连接起来

+0

Woking很好:)谢谢。 –

+0

好听! :) –