2017-01-29 28 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

好聽! :) –