TYPO3 tx_news扩展名不使用覆盖模板

时间:2016-06-16 11:20:54

标签: typo3 typoscript fluid typo3-7.6.x

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

我已经对文件路径进行了三次检查,以确保typoscript指向正确的位置,但它仍然使用默认值。这可能有什么问题?

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/
    }
  }
}

2 个答案:

答案 0 :(得分:4)

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

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

2)然后将其放入模板提供者或页面 typoscript常量

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>

答案 1 :(得分:2)

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

进入BE,选择模板模块,使用 TypoScript对象浏览器,您可以查看安装程序中是否存在任何更改。 (或者,如果您可能有语法错误)

enter image description here