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
}
The corresponding error output is as follows:
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
Try adding a space after
ON
, so:Also,
andWhere
has been deprecated since TYPO3 7.1 and has been removed in 8. You need to add that towhere
and usemarkers
to add the page uid. From the top of my head, that would make it:See https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Select/#markers for more on
markers