TYPO3 tx_news 扩展不使用覆盖模板

标签 typo3 typoscript fluid typo3-7.6.x

我有两个站点使用 tx_news 扩展。据我所知,它们的设置相同。在站点 A 上,我添加了一个新的 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/
    }
  }
}

最佳答案

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

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

2) 然后将其放入您的模板提供程序或页面 typoscript constants:

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

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

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

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>

关于TYPO3 tx_news 扩展不使用覆盖模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37857681/

相关文章:

php - TYPO3:使用构造函数将服务类注入(inject) AuthServiceClass

mysql - TYPO3 typescript mySql选择,获得相同的db字段2次

javascript - 网页上可自由定位的元素(由用户)?

html - CSS 内容重叠

namespaces - TYPO3:在具有供应商命名空间的扩展中编写一个 ViewHelper

linux - TYPO3 的最低权限是什么?

typo3 - 为什么我应该只使用 DDEV 进行本地开发?

typo3 - 根据页面兄弟位置获取页码

php - Typo3 登录屏幕后无法访问后端

mysql - 读取 TYPOscript fe_users 在 COA 中不起作用