如何使用当前页面的相同sys_category获取其他页面标题

时间:2017-06-22 04:21:51

标签: typo3 typoscript

我使用TYPO3 8.7,我希望在当前页面页脚上显示当前页面具有相同sys_category的其他页面的标题。当用户到达页面底部时,他将找到“相关页面”,这些页面与当前页面具有相同的sys_category uid。这可以用typoscript完成吗?

我已尝试过此代码,但这不起作用:

temp.relatedCAT = CONTENT
temp.relatedCAT {
  table = pages
  select {
    // dontCheckPid doesn't exist for CONTENT objects, so make it recursive from root page (or pidInList.data = leveluid:-2
    pidInList = {$pidRoot}
    recursive = 99
    selectFields = sys_category.uid as catUid
    join = sys_category_record_mm ON pages.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
    where = sys_category_record_mm.tablenames = 'pages' AND sys_category_record_mm.uid_foreign = {TSFE:id}
    where.insertData = 1
    // not necessary for this use case
    // orderBy = sys_category.sorting
  }
  renderObj = TEXT
  renderObj {
    field = catUid
    // Hack: if there are no cats selected for a page, all news are displayed
    // so I just pass a catUid that's quite unlikely
    wrap = |
  }
}
lib.related >
lib.related= TEXT
lib.related {

                table = pages
                select {
                        # pid de la racine du site
                        pidInList = 1
                        # récursivité jusqu'au maximum de niveau
                        recursive = 99
                        # jointure sur la sys_cat_mm
                        leftjoin = sys_category_record_mm ON (pages.uid = sys_category_record_mm.uid_foreign)
                        # condition de recherche
                        where = sys_category_record_mm.tablenames =  "pages" AND sys_category_record_mm.uid_local = {$temp.relatedCAT}
                        where.insertData = 1

}
}

1 个答案:

答案 0 :(得分:0)