覆盖扩展模板的最佳方法

best way to overwrite a extension template

覆盖 typo3 扩展的标准模板以保存它们以供更新的最佳方法是什么?

谢谢

试过这个:

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

但什么都没有改变

这是 tx_news 文档中的示例:

TypoScript 设置语法如下所示:

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

文档tx_news:

https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Templating/Start/Index.html

打字错误文档:

https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/Configuration/OverridingFluidTemplates/Index.html

这里是 slickcarousel 的另一个例子:

https://gist.github.com/misterboe/5de7498e810ebd57f7bfb4d2a7abeb66

重要须知: 在 TYPO3 CMS 6.2 之前你可以覆盖设置

templateRootPath  = /path/to/you/template

在 TYPO3 CMS 7.6 及更高版本中,您可以创建一个数组,其中 Fluid / TYPO3 正在寻找模板。命名不同(现在以 "s" 结尾)并且它必须是一个数组。

因此版本 6.x 的旧示例在 7.6 中将不起作用!

templateRootPaths {
    0 = /path/to/originalExtension/template
    1 = /path/to/you/template
}

对于 partialRootPath -> 现在是 partialRootPaths 和 layoutRootPath -> 现在是 layoutRootPaths 相同

这个新数组的优点:如果你只想覆盖一个部分或一个模板:在你自己的扩展名或 Fileadin 文件夹中创建目录,然后只放这个,在那里更改文件

-> 文件名仍应相同
-> 查找 CamelCase 错误(f.e。文件夹名称应为 "Layouts" 而不是 "layouts" .. 这可能适用于 windows 测试系统,但不适用于生产 linux .. -> 清除 TYPO3 缓存 .. 一如既往 ..