类型3 7.4:修改新的tt_content.layout


Typo3 7.4: modify new tt_content.layout

我创建了一个新的tt_content.layout:

TCEFORM.tt_content.layout.addItems.10 = Layout10

现在我该如何更改此布局?我希望首先显示textpic元素的图像,有办法实现吗?怎样

如有任何提示,不胜感激。非常感谢。

如果使用fluid_styled_content:

在常量中定义模板重写的路径。

我是这样做的:

# overrides for fluid_styled_content
# will become lib.fluidContent.templateRootPaths.10
styles.templates.templateRootPath = {$templatePath}/Resources/Private/FSC/Templates
styles.templates.layoutRootPath = {$templatePath}/Resources/Private/FSC/Layouts
styles.templates.partialRootPath = {$templatePath}/Resources/Private/FSC/Partials

这个命令告诉fsc在该文件夹中查找模板。如果它在那里找到它们,它会更喜欢它们而不是原件。

在本例中,它可能是typo3conf/ext/template/Resources/Private/Content/FSC/Templates/Textmedia.html

在那里,您可以使用一个条件来切换渲染布局

  <f:comment>Default Layout</f:comment>
  <f:if condition="{data.layout} == 0">
    <div class="ce-textpic ce-{gallery.position.horizontal} ce-{gallery.position.vertical}{f:if(condition: gallery.position.noWrap, then: ' ce-nowrap')}">
        <f:if condition="{gallery.position.vertical} != 'below'">
            <f:render partial="MediaGallery" arguments="{_all}" />
        </f:if>
        <div class="ce-bodytext">
            <f:if condition="{gallery.position.noWrap}">
                <f:render partial="Header" arguments="{_all}" />
            </f:if>
            <f:format.html>{data.bodytext}</f:format.html>
        </div>
        <f:if condition="{gallery.position.vertical} == 'below'">
            <f:render partial="MediaGallery" arguments="{_all}" />
        </f:if>
    </div>
  </f:if>
  <f:comment>Custom Layout</f:comment>
  <f:if condition="{data.layout} == 10">
    <div class="myclass"><f:format.html>{data.bodytext</f:format.html></div>
  </f:if>

要查看可用的数据,请尝试

<f:debug>{data}</f:debug>

你也可以更深入地挖掘,有时在钻探时会出现更多内容:

<f:debug>{data.someProperty.heresmorestuff}</f:debug>

您只向布局数组添加了一个新选项,但没有定义新布局。

该选项可以用作"case"。如果使用css_styled_content,请查看该扩展的setup.txt类型脚本,位于typep3/sysext/css_styled_content。

如果您使用fluid_styled_content,请查看该扩展。布局选项的值为"10",因此您可以使用流体和If条件在那里定义布局。