Typoscript 通过 pidInList 为 Onepage-Layouted 站点获取内容
Typoscript get content by pidInList for Onepage-Layouted Site
我有一个单页布局,后端的每个页面都是这个前端页面的一部分。每个 section/backendpage 都有自己的布局。以下脚本选择正确的布局:
20 = FLUIDTEMPLATE
20 {
file.cObject = CASE
file.cObject {
key.field = uid
5 = TEXT
5.value = fileadmin/template/green.html
6 = TEXT
6.value = fileadmin/template/blue.html
default = TEXT
default.value = fileadmin/template/default.html
}
这很好用。现在我需要每个部分的正确内容。我尝试了以下方法:
variables {
content < styles.content.get
content{
select {
pidInList = 5
#pidInList = uid
where = colPos= 0
#where = colPos={field: colPos}
orderBy = sorting
}
}
}
将 pidInList 设置为静态值(如 5)有效。但是我需要选择布局文件的正确内容。为什么 uid 不起作用?
这是完整的区块:
lib.sectionContent = HMENU
lib.sectionContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 5
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <div id="|">
20 = FLUIDTEMPLATE
20 {
file.cObject = CASE
file.cObject {
key.field = uid
5 = TEXT
5.value = fileadmin/template/green.html
6 = TEXT
6.value = fileadmin/template/blue.html
default = TEXT
default.value = fileadmin/template/default.html
}
variables {
content < styles.content.get
content{
select {
pidInList.field = uid
where = colPos= 0
#where = colPos={field: colPos}
orderBy = sorting
}
}
}
}
30 = TEXT
30 {
wrap = </div>
}
}
}
}
}
}
这个总是选择默认值:-(
variables {
content < styles.content.get
content{
select {
pidInList.cObject = CASE
pidInList.cObject {
key.field = uid
5 = TEXT
5.value = 5
default = TEXT
default.value = 10
}
}
}
}
当您在模板部分使用 uid 时:
key.field = uid
您需要为内容指定字段uid的用法selection:
pidInList.field = uid
顺便说一句 这样您就可以将模板硬编码分配给页面。
请注意字段 layout
和 backend_layout
,因此编辑者可以 select 从模板池中单独为每个页面设计布局。
同时我不确定 select 直接为 pidInList 创建一个字段的可能性。
但还有一个选择:markers
对于 selects,您可以选择使用和定义标记以提高可读性。
select {
pidInList = ###pageUid###
#where - already set by styles.content.get
#orderBy - already set by styles.content.get
markers {
pageUid.field = uid
}
}
我有一个单页布局,后端的每个页面都是这个前端页面的一部分。每个 section/backendpage 都有自己的布局。以下脚本选择正确的布局:
20 = FLUIDTEMPLATE
20 {
file.cObject = CASE
file.cObject {
key.field = uid
5 = TEXT
5.value = fileadmin/template/green.html
6 = TEXT
6.value = fileadmin/template/blue.html
default = TEXT
default.value = fileadmin/template/default.html
}
这很好用。现在我需要每个部分的正确内容。我尝试了以下方法:
variables {
content < styles.content.get
content{
select {
pidInList = 5
#pidInList = uid
where = colPos= 0
#where = colPos={field: colPos}
orderBy = sorting
}
}
}
将 pidInList 设置为静态值(如 5)有效。但是我需要选择布局文件的正确内容。为什么 uid 不起作用?
这是完整的区块:
lib.sectionContent = HMENU
lib.sectionContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 5
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <div id="|">
20 = FLUIDTEMPLATE
20 {
file.cObject = CASE
file.cObject {
key.field = uid
5 = TEXT
5.value = fileadmin/template/green.html
6 = TEXT
6.value = fileadmin/template/blue.html
default = TEXT
default.value = fileadmin/template/default.html
}
variables {
content < styles.content.get
content{
select {
pidInList.field = uid
where = colPos= 0
#where = colPos={field: colPos}
orderBy = sorting
}
}
}
}
30 = TEXT
30 {
wrap = </div>
}
}
}
}
}
}
这个总是选择默认值:-(
variables {
content < styles.content.get
content{
select {
pidInList.cObject = CASE
pidInList.cObject {
key.field = uid
5 = TEXT
5.value = 5
default = TEXT
default.value = 10
}
}
}
}
当您在模板部分使用 uid 时:
key.field = uid
您需要为内容指定字段uid的用法selection:
pidInList.field = uid
顺便说一句 这样您就可以将模板硬编码分配给页面。
请注意字段 layout
和 backend_layout
,因此编辑者可以 select 从模板池中单独为每个页面设计布局。
同时我不确定 select 直接为 pidInList 创建一个字段的可能性。
但还有一个选择:markers
对于 selects,您可以选择使用和定义标记以提高可读性。
select {
pidInList = ###pageUid###
#where - already set by styles.content.get
#orderBy - already set by styles.content.get
markers {
pageUid.field = uid
}
}