TYPO3 tx_news扩展不使用覆盖模板

use*_*665 1 typo3 fluid typoscript typo3-7.6.x

我有两个使用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/
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

The*_*e F 5

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

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/
    }
}
Run Code Online (Sandbox Code Playgroud)

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

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

tx_news.templateLayouts {
    1 = Special List Item
    2 = Special Detail Layout
}
Run Code Online (Sandbox Code Playgroud)

这样您就可以在新闻插件中选择以下模板布局之一,并在模板文件中使用条件:

<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>
Run Code Online (Sandbox Code Playgroud)

  • 实际上,在常量中您可以使用单数形式,因为它是一个常量,而在设置中,您应该使用复数形式,因为这是处理具有后备功能的多个模板的逻辑。 (2认同)