【问题标题】:How to get other pages titles with same sys_category of the current page如何获取与当前页面具有相同 sys_category 的其他页面标题
【发布时间】:2017-06-22 04:21:50
【问题描述】:

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

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

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

}
}

【问题讨论】:

  • lib.related= TEXT 与以下属性不匹配。应该是lib.related= CONTENT

标签: typo3 typoscript


【解决方案1】:

使用带有special = categories 的HMENU 对象怎么样? 见:https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html#special-categories

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-22
    • 2022-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多