4
显示新闻从来就做出不同的模板布局来选择后端的编辑,我theme's配置PageTSconfig:如何在我的输入法中设置tx_news特定条件?
tx_news.templateLayouts {
10 = LLL:EXT:mytheme/Resources/Private/Language/locallang.xlf:news.layout.withoutDate
20 = LLL:EXT:mytheme/Resources/Private/Language/locallang.xlf:news.layout.highlightListView
30 = LLL:EXT:mytheme/Resources/Private/Language/locallang.xlf:news.layout.imageTeaserListView
}
在我的流体模板我可以切换条件像
<f:switch expression="{settings.templateLayout}">
<f:case value="10">
... use layout 1
</f:case>
<f:case value="20">
... use layout 2
</f:case>
<f:case value="30">
... use layout 3
</f:case>
</f:switch>
一切在这里工作得很好。
现在我想嵌入JavaScript的只有这些模板布局之一。 所以我试图在typoscript的条件中包含js,要求在此templateLayout设置中的值。类似这样的:
[globalVar = GP:tx_news_pi1|settings|templateLayout=30]
page{
includeJSFooter {
test = EXT:mytheme/Resources/Public/JavaScript/news-test.js
}
}
[global]
但是这种情况不起作用。所以我的问题:什么是错的?我怎样才能管理这个工作,为病情获得正确的价值? 我希望任何人都可以提前帮助,thanx。
为了完整:一个例子,如何使用模板选择器也可以在[新闻扩展的官方手册]中找到(https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/Templates/TemplateSelector/Index.html) –