在tx_news记录的详细页面上,我还提供了当前文章/记录的"相关文章"。。。下面的片段。但在建议的"相关文章"中,也提供了当前记录。如何将当前文章从建议列表中排除?
打字文字:
lib.relatedByFirstCategory.articles = USER
lib.relatedByFirstCategory.articles {
userFunc = TYPO3CMSExtbaseCoreBootstrap->run
extensionName = News
pluginName = Pi1
vendorName = GeorgRinger
switchableControllerActions {
News {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
#relatedView = 1
detailPid = 97
useStdWrap := addToList(categories)
categories.current = 1
categoryConjunction = or
overrideFlexformSettingsIfEmpty := addToList(detailPid)
startingpoint = 96
templateLayout = 4
hidePagination = 1
# added
excludeAlreadyDisplayedNews =1
}
}
新闻详情.html
<!-- related articles -->
<f:if condition="{newsItem.firstCategory}">
<f:cObject typoscriptObjectPath="lib.relatedByFirstCategory.articles">{newsItem.firstCategory.uid}</f:cObject>
</f:if>
</f:if>
来源:https://docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#show-具有相同类别的新闻项目详细html
excludeAlreadyDisplayedNews
是您的朋友。看这里:https://docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#excludealreadydisplayednews