[英]How to use Typoscript conditions for page uid?
How do I use conditions to put different headerdata on the home page and 3 other pages using typoscript?如何使用条件在主页和其他 3 个使用打字稿的页面上放置不同的标题数据?
I have tried this:我试过这个:
page {
[treeLevel = 0]
headerData.20.value = Home Page
[END]
[page|uid = 1]
headerData.20.value = Page 1
[END]
[page|uid = 2]
headerData.20.value = Page 2
[END]
[page|uid = 3]
headerData.20.value = Page 3
[END]
}
But the home page outputs Page 3
但是首页输出的是Page 3
I have also tried [globalVar = TSFE:id = X]
with the same result.我也试过[globalVar = TSFE:id = X]
得到相同的结果。
And the object Browser says [
is an invalid character? object 浏览器说[
是无效字符?
I realised the problem is because I nested the conditions inside page
.我意识到问题是因为我将条件嵌套在page
中。 After taking them out it all works fine.取出它们后,一切正常。
According to documentation ( thanks to @BerndWilkeπφ for reminding ), TypoScript conditions must be placed on top level of your TS ( outside of any other structures).根据文档(感谢@BerndWilkerπφ 的提醒),TypoScript 条件必须放在您的 TS 的顶层(在任何其他结构之外)。
Not in any cObject like page
, neither within other conditions.不在任何 cObject 之类的page
中,也不在其他条件下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.