在TYPO3中显示当前页面的类别名称 [英] Show category names of current page in TYPO3 8

查看:102
本文介绍了在TYPO3中显示当前页面的类别名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在TYPO3 8安装上显示当前页面的类别名称。在TYPO3 7中,它曾经这样工作(请参见下文),但是现在我只收到一个随机错误代码,没有文本输出。有想法吗?

I am trying to display the category name(s) of the current page on a TYPO3 8 installation. In TYPO3 7 it used to work like this (see below), however now I only receive a random error code and no Text output. Any Ideas?

lib.catclass = CONTENT
lib.catclass {

wrap = <div class="categories">|</div>

table = sys_category
select {
  pidInList = 35 // UiD of your category_page
  join = sys_category_record_mm ON(sys_category_record_mm.uid_local=sys_category.uid)
  where = sys_category_record_mm.tablenames='pages'
  andWhere.dataWrap = sys_category_record_mm.uid_foreign = {TSFE:id}
}

renderObj = TEXT
renderObj.field = title
renderObj.wrap = <li class="category {field:title}">|</li>
renderObj.insertData = 1

}

相应的错误输出如下:

    An exception occurred while executing 'SELECT * FROM `sys_category` INNER JOIN `sys_category_record_mm`
    `ON(sys_category_record_mm`.`uid_local=sys_category`.`uid)` ON WHERE 
    (`sys_category`.`pid` IN (35)) AND 
    (sys_category_record_mm.tablenames='pages') AND (`sys_category`.`sys_language_uid` IN (0, -1)) AND 
((`sys_category`.`deleted` = 0) AND (`sys_category`.`t3ver_state` <= 0) AND (`sys_category`.`pid` <> -1) AND (`sys_category`.`hidden` = 0) AND (`sys_category`.`starttime` <= 1546204860) AND
 ((`sys_category`.`endtime` = 0) OR (`sys_category`.`endtime` > 1546204860)))': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near '.`uid_local=sys_category`.`uid)` ON WHERE (`sys_category`.`pid` IN (35)) AND (s' at line 1


推荐答案

尝试在 ON ,因此:

join = sys_category_record_mm ON (sys_category_record_mm.uid_local=sys_category.uid)

此外,和位置自TYPO3 7.1起已弃用,并已在8中删除。您需要将其添加到 where 并使用 markers 添加

Also, andWhere has been deprecated since TYPO3 7.1 and has been removed in 8. You need to add that to where and use markers to add the page uid. From the top of my head, that would make it:

lib.catclass = CONTENT
lib.catclass {
  wrap = <div class="categories">|</div>

  table = sys_category
  select {
    pidInList = 35 // UiD of your category_page
    join = sys_category_record_mm ON (sys_category_record_mm.uid_local=sys_category.uid)
    where = sys_category_record_mm.tablenames='pages' AND sys_category_record_mm.uid_foreign = ###pageuid###
    markers {
      pageuid.data = TSFE:id
    }
  }

  renderObj = TEXT
  renderObj.field = title
  renderObj.wrap = <li class="category {field:title}">|</li>
  renderObj.insertData = 1
}

请参见 https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Select/#标记以获取有关标记

这篇关于在TYPO3中显示当前页面的类别名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆