如何覆盖fluid_styled_content中内容元素的呈现?

时间:2018-08-17 11:43:04

标签: typo3 override typoscript typo3-8.x fluid-styled-content

在TYPO3 8.7中,我试图覆盖fluid_styled_content中的文件Textpic.html,以便可以将自己的呈现用于textpic内容元素。

只要我在扩展本身中修改原始文件,就可以正常工作。

但是,我想创建自己的该文件副本并使用该副本。这不起作用-TYPO3不使用我自己的文件版本。

这是我所做的:

在我的TypoScript模板的“设置”字段中,添加了:

lib.contentElement.templateRootPaths.100 = /fileadmin/template/Templates/

然后我将Textpic.html中的fluid_styled_content/Resources/Private/Templates复制到了文件夹/fileadmin/template/Templates中,使它成为/fileadmin/template/Templates/Textpic.html

任何提示,我可能会缺少什么?

2 个答案:

答案 0 :(得分:0)

您可以通过设置常量来做到这一点。例如

styles.templates {
    templateRootPath = EXT:siteconfig/Resources/Private/Extensions/fluid_styled_content/Templates/

    partialRootPath = EXT:siteconfig/Resources/Private/Extensions/fluid_styled_content/Partials/

    layoutRootPath = EXT:siteconfig/Resources/Private/Extensions/fluid_styled_content/Layouts/
}

因此,将首先检查这些位置,如果没有某个内容元素的文件,将使用fluid_styled_content的版本。

在/typo3/sysext/fluid_styled_content/Configuration/TypoScript/constants.txt中检查原始文件

确保对子片段保留相同的子文件夹结构。

答案 1 :(得分:0)

问题出在线

lib.contentElement.templateRootPaths.100 = /fileadmin/template/Templates/

此行是错误的。路径的开头不能有任何斜线。

右行显示为:

lib.contentElement.templateRootPaths.100 = fileadmin/template/Templates/

我在https://docs.typo3.org/typo3cms/TemplatingTutorial/BasicFluidTemplates/Index.html的模板教程的代码示例中发现了这一点。