2

我有两个使用 tx_news 扩展的站点。据我所知,它们的设置相同。现场 AI 添加了一个新的 List.html 部分,它按预期工作。但是在站点 B 上,它完全忽略了我的列表覆盖。

我已经三重检查了文件路径以确保打字稿指向正确的位置,但它仍然使用默认值。这里有什么问题?

plugin.tx_news {
  view {
    templateRootPaths >
    templateRootPaths {
      0 = EXT:news/Resources/Private/Templates/
      1 = fileadmin/templates/example/news/Templates/
    }
    partialRootPaths >
    partialRootPaths {
      0 = EXT:news/Resources/Private/Partials/
      1 = fileadmin/templates/example/news/Partials/
    }
    layoutRootPaths >
    layoutRootPaths {
      0 = EXT:news/Resources/Private/Layouts/
      1 = fileadmin/templates/example/news/Layouts/
    }
  }
}
4

2 回答 2

6

为了使其按预期工作,我将执行以下操作:

1)将ext/news/Resources/Private/Templates、Partials、Layouts这三个文件夹复制到fileadmin/templates/example/news(相信你已经做到了)

2)然后将其放入您的模板提供程序或页面排版常量

plugin.tx_news {
    view {
        templateRootPath = fileadmin/templates/example/news/Templates/
        partialRootPath = fileadmin/templates/example/news/Partials/
        layoutRootPath = fileadmin/templates/example/news/Layouts/
    }
}

现在新闻扩展将使用放置在 fileadmin/ 中的模板文件

下一步是在您的根页面属性中添加一些 pageTSConfig,以防您需要更大的灵活性。例如像这样:

tx_news.templateLayouts {
    1 = Special List Item
    2 = Special Detail Layout
}

这允许您在新闻插件中选择这些模板布局之一,并在模板文件中使用条件:

<f:if condition="{settings.templateLayout} == 1">
    <f:then>
        <!-- markup for a special list item -->
    </f:then>
    <f:else>
        <!-- markup for another list item -->
    </f:else>
</f:if>
于 2016-06-16T12:46:45.227 回答
3

你的脚本看起来不错。当在 TYPO3 中发生类似情况时,可以选择检查您的 TypoScript 是否有效,或者此更改是否真正添加到正确的位置。

进入 BE,选择模板模块,然后使用TypoScript 对象浏览器,您可以查看设置中是否存在所有更改。(或者如果您可能有语法错误)

在此处输入图像描述

于 2016-06-17T04:54:36.863 回答