César Dueñas
César Dueñas

Reputation: 331

How get Categories of a single tt_news for Typoscript

I want to get the categories of a single new but the Typoscript code:

page.100.data = GP:tx_ttnews|cat

Does not work, the return show cat = 0 in the page.

I need this value for set it in a list tt_news in its categorySelection

Upvotes: 0

Views: 258

Answers (1)

Georg Ringer
Georg Ringer

Reputation: 7939

Is the category really in the URL? That is not the case for a single news. You only have the news uid and need to do the join yourself.

Try something like that

[globalVar = GP:tx_ttnews|tt_news > 0]
lib.categoryTitle = COA
lib.categoryTitle {

  20 = RECORDS
  20 {
    source.data = register:newsCategoryUid
    tables = tt_news_cat
    conf.tt_news_cat = TEXT
    conf.tt_news_cat.field = title
    conf.tt_news_cat.noTrimWrap = || - |
  }

}

Upvotes: 2

Related Questions