I would like to read out a page's system categories for further use with tx_news (to display news that have the same categories as the page - as tx_news is using system categories).
I was looking for a native solution, hopefully via getText, something like:
plugin.tx_news.settings.categories.data = page:categories
but that doesn't seem to exist yet
Also, I tried to simplify the query by using sys_category_records_mm, which contains all the information needed for that case, but TYPO3 complains that "there is no entry in the $TCA array":
lib.categoryUid = CONTENT
lib.categoryUid {
wrap = kategorien:|
table = sys_category_record_mm
select {
selectFields = uid
where = uid_foreign = {TSFE:id}
where.insertData = 1
}
renderObj = TEXT
renderObj {
field = uid
wrap = |,
}
}
So that would be nice, but it's not allowed.
I found this example (in German) and modified it to display the category UIDs.
The following TypoScript will display the UIDs of all categories for the current page seperated by a comma.
Unfortunately you have to set
pidInList
manually to a list of UIDs, where your categories are stored.Looking for the cat-id of a page: I did it this way:
Here's a solution that works in my setup. The editor chooses categories for the page, and gets all news items that belong to the category.
What is unclear to me still is if
recursive = 1
in the select has no setback. Actually, I don't want to check for the current page's parent uid at all, butWHERE pages.pid IN ({current pid})
is always inserted automatically. Therefore therecursive = 1
.