【问题标题】:How do I override the rendering of a Content Element in fluid_styled_content?如何覆盖 Fluid_styled_content 中内容元素的呈现?
【发布时间】:2018-08-17 11:43:03
【问题描述】:

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

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

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

这是我所做的:

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

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

然后我将Textpic.htmlfluid_styled_content/Resources/Private/Templates复制到我的文件夹/fileadmin/template/Templates,这样它就变成了/fileadmin/template/Templates/Textpic.html

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

【问题讨论】:

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


    【解决方案1】:

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

    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 中查看原文

    确保为部分保留相同的子文件夹结构。

    【讨论】:

    • 我现在也尝试过这种方式,但没有成功。我已经两次和三次检查了文件路径,但我没有看到那里有错误。实际上,我对部分做的完全一样,它正在工作......
    • 它应该可以工作。你清除缓存了吗?您没有将 Textmedia 与 Textpic 混为一谈吗?您是否在
      中更改了模板?
    【解决方案2】:

    问题出在这条线上

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

    这条线是错误的。路径的开头不能有斜线。

    右行写着:

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

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

    【讨论】:

    • 在 Typoscript 对象浏览器中可以看到 lib.contentElement.templateRootPaths.10 指的是我放在上面的常量。
    猜你喜欢
    • 2018-03-21
    • 2011-12-22
    • 1970-01-01
    • 2017-08-22
    • 2013-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多