0

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

TCEFORM.tt_content.layout.addItems.10 = Layout10

现在如何更改此布局的外观?我希望首先显示 textpic 元素的图像,有没有办法实现这一点?如何?

任何提示将不胜感激。谢谢你。

4

2 回答 2

1

如果您使用流体样式内容:

在常量中定义模板覆盖的路径。

这是我的做法:

# 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>
于 2016-04-12T09:15:44.793 回答
0

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

该选项可以用作“案例”。如果您使用 css_styled_content,请在typo3/sysext/css_styled_content 中查看此扩展程序的 setup.txt 打字稿。

如果您使用流体样式内容,请查看该扩展名。布局选项的值为“10”,因此您可以使用流体和 If 条件来定义您的布局。

于 2016-04-11T12:14:32.450 回答