后端布局和打字错误不适用于 TYPO3 中的 Basic2column
Backend layout and typoscript not working for Basic2column in TYPO3
我创建了一个名为 "doubleColumn" 的后端布局。现在在后端管理面板中,我左右有 2 列。我在左右栏中添加了一些虚拟内容。但是当我为双列模板写错字时。然后它在前端向我显示错误。我该如何修复这个错误?
这是我遇到的错误
Oops, an error occurred! Tried resolving a template file for
controller action "Standard->index" in the format ".html", but none of
the paths contained the expected template file (). No paths
configured.
有关此错误的更多信息可能在线提供。
Basic2ColumnPage.html
<div class="left-column">
<f:format.raw>{Leftcontent}</f:format.raw>
</div>
<div class="right-column">
<f:format.raw>{Rightcontent}</f:format.raw>
</div>
DoubleColumn 是一个页面名称,我在 DoubleColumn 模板中添加了这个打字错误
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
1 = Text
1.value = fileadmin/templates/demo/Resources/Private/Layouts/Basic2ColumnPage.html
}
variables {
Leftcontent >StyleSheet.content.get
Leftcontent.select.where = colPos=0
Rightcontent < styles.content.get
Rightcontent.select.where = colpos=1
}
}
}
这是我的后端布局(TS-config)
mod.web_layout.BackendLayouts {
exampleKey {
title = Example
icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif
config {
backend_layout {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Left content
colPos = 0
}
2 {
name = Right content
colPos = 1
}
}
}
}
}
}
}
}
不要做的太复杂。 属性 file
是可能的,但不是很灵活。并且您错过了新 (backend_) 布局的配置。
TSconfig 中定义的布局以 pagets__
(两个下划线!)为前缀。
一种干净的配置方式是:
- 使用路径:
10 {
templateRootPaths.1 = EXT:site_ext/Resources/Private/Templates
partialRootPaths.1 = EXT:site_ext/Resources/Private/Partials
layoutRootPaths.1 = EXT:site_ext/Resources/Private/Layouts
:
- 仅指定模板名称(不需要文件扩展名):
:
templateName = TEXT
templateName.cObject = CASE
templateName.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
#Default Template
default = TEXT
default.value = Default
1 = TEXT
1.value = Basic2ColumnPage
pagets__Example = TEXT
pagets__Example.value = Example
}
:
您可以立即使用字段中的值,但是您的模板需要有特殊的名称,或者您必须去掉前缀。并确保如果不存在匹配的模板会发生什么。
我创建了一个名为 "doubleColumn" 的后端布局。现在在后端管理面板中,我左右有 2 列。我在左右栏中添加了一些虚拟内容。但是当我为双列模板写错字时。然后它在前端向我显示错误。我该如何修复这个错误?
这是我遇到的错误
Oops, an error occurred! Tried resolving a template file for controller action "Standard->index" in the format ".html", but none of the paths contained the expected template file (). No paths configured.
有关此错误的更多信息可能在线提供。
Basic2ColumnPage.html
<div class="left-column">
<f:format.raw>{Leftcontent}</f:format.raw>
</div>
<div class="right-column">
<f:format.raw>{Rightcontent}</f:format.raw>
</div>
DoubleColumn 是一个页面名称,我在 DoubleColumn 模板中添加了这个打字错误
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
1 = Text
1.value = fileadmin/templates/demo/Resources/Private/Layouts/Basic2ColumnPage.html
}
variables {
Leftcontent >StyleSheet.content.get
Leftcontent.select.where = colPos=0
Rightcontent < styles.content.get
Rightcontent.select.where = colpos=1
}
}
}
这是我的后端布局(TS-config)
mod.web_layout.BackendLayouts {
exampleKey {
title = Example
icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif
config {
backend_layout {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Left content
colPos = 0
}
2 {
name = Right content
colPos = 1
}
}
}
}
}
}
}
}
不要做的太复杂。 属性 file
是可能的,但不是很灵活。并且您错过了新 (backend_) 布局的配置。
TSconfig 中定义的布局以 pagets__
(两个下划线!)为前缀。
一种干净的配置方式是:
- 使用路径:
10 {
templateRootPaths.1 = EXT:site_ext/Resources/Private/Templates
partialRootPaths.1 = EXT:site_ext/Resources/Private/Partials
layoutRootPaths.1 = EXT:site_ext/Resources/Private/Layouts
:
- 仅指定模板名称(不需要文件扩展名):
:
templateName = TEXT
templateName.cObject = CASE
templateName.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
#Default Template
default = TEXT
default.value = Default
1 = TEXT
1.value = Basic2ColumnPage
pagets__Example = TEXT
pagets__Example.value = Example
}
:
您可以立即使用字段中的值,但是您的模板需要有特殊的名称,或者您必须去掉前缀。并确保如果不存在匹配的模板会发生什么。