【发布时间】:2019-01-06 11:30:46
【问题描述】:
在Blog Post 的帮助下,我正在创建一个 Typo3 OnePager 网站。它将根页面的所有子页面作为 OnePager 中的部分加载。这项工作正如解释的那样,但它只直接从 tt_content 加载内容,而不是通过 Fluidtemplate。我希望它与 Fuildtemplate 一起加载,因为我有几个不同的模板可以在后端选择。
所以加载内容和模板的整个 TS 如下所示:
lib.sectionContent = HMENU
lib.sectionContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 4
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <section id="|">
20 = CONTENT
20 < styles.content.get
20 {
table = tt_content
select.where.field = column
select.where.wrap = colPos = |
}
}
30 = TEXT
30 {
wrap = </section>
}
}
}
}
}
}
lib.mainTemplate = FLUIDTEMPLATE
lib.mainTemplate{
templateName = TEXT
templateName.stdWrap{
cObject = TEXT
cObject{
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
}
ifEmpty = contentPage1column
}
templateRootPaths {
10 = {$path.privat}Templates/Page/
}
layoutRootPaths {
10 = {$path.privat}Layouts/Page/
}
partialRootPaths {
10 = {$path.privat}Partials/Page/
}
}
在模板中,我使用
加载内容<f:format.raw><f:cObject typoscriptObjectPath="lib.sectionContent" data="{column:0}" /></f:format.raw>
但是当我尝试加载 FE 时,我得到了这个错误:
执行 'SELECT * FROM tt_content WHERE (tt_content.pid IN (1)) AND (colPos =) AND (tt_content.sys_language_uid = 0) AND ((@ 987654329@.deleted = 0) AND (tt_content.t3ver_state tt_content.pid -1) AND (tt_content.hidden = 0) AND ( tt_content.starttime tt_content.endtime = 0) OR (tt_content.endtime > 1546847160))@ AND (((@987653443@.@987 ') OR (tt_content.fe_group IS NULL) OR (tt_content.fe_group = '0') OR (FIND_IN_SET('0', tt_content.fe_group)) OR (FIND_IN_SET(' -1', tt_content.fe_group))))) ORDER BY sorting ASC': 你的 SQL 语法有错误;查看与您的 MariaDB 服务器版本相对应的手册,了解在第 1 行的 ') AND (tt_content.sys_language_uid = 0) AND ((tt_content.deleted = 0) AN' 附近使用的正确语法
我做错了什么?
谢谢!
【问题讨论】:
-
您正在查询一个 templateName!为什么取一个简单的名字那么复杂?看起来你混合了名称和内容。
-
是的,你是对的。我已经更改了 TS,以便 lib.sectionContent 应该加载内容,然后 lib.mainTemplate 应该从后端获取模板名称。我在我的帖子中更新了它。我认为我弄错的部分是我实际使用 styles.content.get 加载内容的部分,但我不知道如何修复它。
标签: templates typo3 typoscript