TYPO3 Gridelements w/DataProcessing 和 FLUID 无内容
TYPO3 Gridelements w/DataProcessing and FLUID no content
我现在使用 Gridelements 有一段时间了。我使用了以下代码:
TypoScript(Gridelements(已弃用)(gridelements)):
tt_content.gridelements_pi1.20.10.setup {
2col < lib.gridelements.defaultGridSetup
2col.cObject = FLUIDTEMPLATE
2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}
流体模板:
<div class="row">
<div class="col-md-6">
{data.tx_gridelements_view_column_0}
</div>
<div class="col-md-6">
{data.tx_gridelements_view_column_1}
</div>
</div>
页码:
tx_gridelements.setup {
2col {
title = Two Columns
config {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Links
colPos = 0
}
2 {
name = Rechts
colPos = 1
}
}
}
}
}
}
}
但现在我想使用“Gridelements w/DataProcessing(推荐)(gridelements)”,因为另一个已被弃用。但我只看到错误:
Tried resolving a template file for controller action "Standard->2col"
in format ".html", but none of the paths contained the expected
template file (Standard/2col.html). The following paths were checked:
/var/www/html/typo3/sysext/fluid_styled_content/Resources/Private/Templates/,
/var/www/html/typo3/typo3conf/ext/gridelements/Resources/Private/Templates/,
/var/www/html/typo3/typo3conf/ext/dev_layout/Resources/Private/Templates/
如果我在我的 TypoScript 代码中这样写:
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateRootPaths {
20 = {$resDir}/Private/Templates/Gridelements/
}
}
tt_content.gridelements_pi1 < lib.gridelements.defaultGridSetup
tt_content.gridelements_view < tt_content.gridelements_pi1
并且当我创建命名文件时,错误不再出现。但是没有输出。我看到了 div 但没有内容。如何从已弃用的网格元素切换到数据处理网格元素?
问题是这段代码
tt_content.gridelements_pi1.20.10.setup {
2col < lib.gridelements.defaultGridSetup
2col.cObject = FLUIDTEMPLATE
2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}
与您包含的新静态不匹配。
看看文档中显示的基本示例:
https://docs.typo3.org/typo3cms/extensions/gridelements/stable/Chapters/DataProcessing/Index.html
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateName.field = tx_gridelements_backend_layout
templateName.ifEmpty = GridElement
layoutRootPaths {
1 = EXT:gridelements/Resources/Private/Layouts/
}
partialRootPaths {
1 = EXT:gridelements/Resources/Private/Partials/
}
templateRootPaths {
1 = EXT:gridelements/Resources/Private/Templates/
}
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
default {
as = children
# Default options of the grid children processor
# Change them according to the needs of your layout
# Read more about it in the TypoScript section of the manual
# options {
# sortingDirection = ASC
# sortingField = sorting
# recursive = 0
# resolveFlexFormData = 1
# resolveBackendLayout = 1
# respectColumns = 1
# respectRows = 1
# }
}
}
}
}
现在,如果您想添加自己的模板和渲染配置,您只需在 dataProcessing.10
中添加一些内容,例如
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
2col {
as = columncontent
options {
resolveFlexFormData = 0
respectRows = 0
}
}
accordion {
as = accordionitems
options {
resolveFlexFormData = 0
respectRows = 0
respectColumns = 0
}
}
}
}
变量的名称仍然可以是 children
,但处理与模板用途相匹配的变量名称可能更方便。
我找到了解决方案:
模板:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="row">
<f:if condition="{children}">
<f:for each="{children.1}" as="column" key="columnNumber">
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
<f:for each="{column}" as="child">
<f:render partial="Child"
arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
</f:for>
</div>
</f:for>
</f:if>
</div>
</html>
对于两个不同的列
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} {f:if(condition: '{columnNumber} == 0', then: 'col-lg-3', else: 'col-lg-9')}">
我的列号是左边0右边1
数据处理中的 TS.10:
2col {
as = children
options {
resolveChildFlexFormData = 0
}
}
}
文档有误你需要这个
tt_content.gridelements_pi1 =< lib.contentElement
TS 配置:
默认网格元素 TSConfig
“文档有误,您需要这个”
tt_content.gridelements_pi1 =< lib.contentElement
确定吗?我仍然可以使用原件,因为它写在 w / DataProcessing 的示例中:
lib.gridelements.defaultGridSetup =< lib.contentElement
我从 Typo3 9 升级到最新的 TYPO3 10 版本并包含 Gridelement(推荐)后,我遇到了同样的错误。
Tried resolving a template file for controller action "Standard->1" in format ".html", but none of the paths contained the expected template file (Standard/1.html). The following paths were checked:
解法:
- 将 gridelement 模板名称重命名为 1.html for gridelement uid=1
- 将 TS 更改为:
tt_content.gridelements_pi1 {
templateRootPaths {
15 = EXT:site_config/Resources/Private/Templates/Extensions/Grid-Templates/
}
dataProcessing {
10 {
default {
options {
resolveFlexFormData = 1
resolveChildFlexFormData = 0
}
}
}
}
}
在 Grid-Templates 中添加您的网格元素模板,例如 1.html、2.html 等。
3) 像这样更改模板(HTML) 代码:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="row">
<f:if condition="{children}">
<f:for each="{children.1}" as="column" key="columnNumber">
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
<f:for each="{column}" as="child">
<f:render partial="Child"
arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
</f:for>
</div>
</f:for>
</f:if>
</div>
</html>
我现在使用 Gridelements 有一段时间了。我使用了以下代码:
TypoScript(Gridelements(已弃用)(gridelements)):
tt_content.gridelements_pi1.20.10.setup {
2col < lib.gridelements.defaultGridSetup
2col.cObject = FLUIDTEMPLATE
2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}
流体模板:
<div class="row">
<div class="col-md-6">
{data.tx_gridelements_view_column_0}
</div>
<div class="col-md-6">
{data.tx_gridelements_view_column_1}
</div>
</div>
页码:
tx_gridelements.setup {
2col {
title = Two Columns
config {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Links
colPos = 0
}
2 {
name = Rechts
colPos = 1
}
}
}
}
}
}
}
但现在我想使用“Gridelements w/DataProcessing(推荐)(gridelements)”,因为另一个已被弃用。但我只看到错误:
Tried resolving a template file for controller action "Standard->2col" in format ".html", but none of the paths contained the expected template file (Standard/2col.html). The following paths were checked: /var/www/html/typo3/sysext/fluid_styled_content/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/gridelements/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/dev_layout/Resources/Private/Templates/
如果我在我的 TypoScript 代码中这样写:
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateRootPaths {
20 = {$resDir}/Private/Templates/Gridelements/
}
}
tt_content.gridelements_pi1 < lib.gridelements.defaultGridSetup
tt_content.gridelements_view < tt_content.gridelements_pi1
并且当我创建命名文件时,错误不再出现。但是没有输出。我看到了 div 但没有内容。如何从已弃用的网格元素切换到数据处理网格元素?
问题是这段代码
tt_content.gridelements_pi1.20.10.setup {
2col < lib.gridelements.defaultGridSetup
2col.cObject = FLUIDTEMPLATE
2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}
与您包含的新静态不匹配。
看看文档中显示的基本示例:
https://docs.typo3.org/typo3cms/extensions/gridelements/stable/Chapters/DataProcessing/Index.html
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateName.field = tx_gridelements_backend_layout
templateName.ifEmpty = GridElement
layoutRootPaths {
1 = EXT:gridelements/Resources/Private/Layouts/
}
partialRootPaths {
1 = EXT:gridelements/Resources/Private/Partials/
}
templateRootPaths {
1 = EXT:gridelements/Resources/Private/Templates/
}
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
default {
as = children
# Default options of the grid children processor
# Change them according to the needs of your layout
# Read more about it in the TypoScript section of the manual
# options {
# sortingDirection = ASC
# sortingField = sorting
# recursive = 0
# resolveFlexFormData = 1
# resolveBackendLayout = 1
# respectColumns = 1
# respectRows = 1
# }
}
}
}
}
现在,如果您想添加自己的模板和渲染配置,您只需在 dataProcessing.10
中添加一些内容,例如
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
2col {
as = columncontent
options {
resolveFlexFormData = 0
respectRows = 0
}
}
accordion {
as = accordionitems
options {
resolveFlexFormData = 0
respectRows = 0
respectColumns = 0
}
}
}
}
变量的名称仍然可以是 children
,但处理与模板用途相匹配的变量名称可能更方便。
我找到了解决方案:
模板:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="row">
<f:if condition="{children}">
<f:for each="{children.1}" as="column" key="columnNumber">
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
<f:for each="{column}" as="child">
<f:render partial="Child"
arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
</f:for>
</div>
</f:for>
</f:if>
</div>
</html>
对于两个不同的列
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} {f:if(condition: '{columnNumber} == 0', then: 'col-lg-3', else: 'col-lg-9')}">
我的列号是左边0右边1
数据处理中的 TS.10:
2col {
as = children
options {
resolveChildFlexFormData = 0
}
}
}
文档有误你需要这个
tt_content.gridelements_pi1 =< lib.contentElement
TS 配置: 默认网格元素 TSConfig
“文档有误,您需要这个”
tt_content.gridelements_pi1 =< lib.contentElement
确定吗?我仍然可以使用原件,因为它写在 w / DataProcessing 的示例中:
lib.gridelements.defaultGridSetup =< lib.contentElement
我从 Typo3 9 升级到最新的 TYPO3 10 版本并包含 Gridelement(推荐)后,我遇到了同样的错误。
Tried resolving a template file for controller action "Standard->1" in format ".html", but none of the paths contained the expected template file (Standard/1.html). The following paths were checked:
解法:
- 将 gridelement 模板名称重命名为 1.html for gridelement uid=1
- 将 TS 更改为:
tt_content.gridelements_pi1 { templateRootPaths { 15 = EXT:site_config/Resources/Private/Templates/Extensions/Grid-Templates/ } dataProcessing { 10 { default { options { resolveFlexFormData = 1 resolveChildFlexFormData = 0 } } } } }
在 Grid-Templates 中添加您的网格元素模板,例如 1.html、2.html 等。 3) 像这样更改模板(HTML) 代码:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="row">
<f:if condition="{children}">
<f:for each="{children.1}" as="column" key="columnNumber">
<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
<f:for each="{column}" as="child">
<f:render partial="Child"
arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
</f:for>
</div>
</f:for>
</f:if>
</div>
</html>