Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TYPO3 tx_新闻扩展未使用覆盖模板_Typo3_Typoscript_Fluid_Typo3 7.6.x - Fatal编程技术网

TYPO3 tx_新闻扩展未使用覆盖模板

TYPO3 tx_新闻扩展未使用覆盖模板,typo3,typoscript,fluid,typo3-7.6.x,Typo3,Typoscript,Fluid,Typo3 7.6.x,我有两个网站使用tx_新闻扩展。据我所知,它们的设置完全相同。在站点A上,我添加了一个新的List.html部分,它可以按预期工作。但在站点B上,它完全忽略了我的列表覆盖 我已经三次检查了文件路径,以确保打字脚本指向正确的位置,但它仍然使用默认值。这里可能出了什么问题 plugin.tx_news { view { templateRootPaths > templateRootPaths { 0 = EXT:news/Resources/Private/T

我有两个网站使用tx_新闻扩展。据我所知,它们的设置完全相同。在站点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) 然后将其放入模板提供程序或页面打字脚本常量中:

plugin.tx_news {
    view {
        templateRootPath = fileadmin/templates/example/news/Templates/
        partialRootPath = fileadmin/templates/example/news/Partials/
        layoutRootPath = fileadmin/templates/example/news/Layouts/
    }
}
现在,新闻扩展将使用fileadmin中的模板文件/

下一步是在根页面属性中添加一些PageTconfig,以防需要更大的灵活性。例如:

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中时,有一个选项可以检查您的打字稿是否有效,或者这些更改是否真正添加到正确的位置

进入BE,选择模板模块,使用打字脚本对象浏览器可以查看设置中是否存在所有更改。(或者如果您可能有语法错误)


你不应该再使用不推荐的
templateRootPath
等,而应该使用复数版本,
templateRootPath
。如果你是这个意思,我不知道。但是,在我的情况下,它适用于6.2.25和7.6.9安装。实际上,在常量中,您可以使用单数,因为它是一个常量;在设置中,您应该使用复数,因为这是处理具有回退功能的多个模板的逻辑。如果通过设置您的模板。@AndrásOttó检查对象浏览器时发现我在安装脚本前面缺少了一个}。将其添加回中修复了该问题。简单!回答一个问题,我会选择它。