TYPO3-tx_news-在详细信息页面上显示相关文章(当前文章除外)

时间:2018-08-06 09:01:10

标签: typo3 typoscript typo3-8.x tx-news typo3-8.7.x

在tx_news记录的详细信息页面上,我还提供带有以下代码段的当前文章/记录的“相关文章”。但是在建议的“相关文章”中也提供了当前记录。如何从建议列表中排除当前文章?

打字稿:

lib.relatedByFirstCategory.articles = USER
lib.relatedByFirstCategory.articles {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->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        
    }
}

News Detail.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-news-items-with-same-category-in-detail-html

1 个答案:

答案 0 :(得分:2)