Markus Buff
Markus Buff

Reputation: 21

Set a category in tx_news by default

I would like to set a category by default to all new tx_news records. I know the solution is located in user TSConfig. But I don't know how to work with that using a kind of condition. I guess it has to be something like

TCAdefaults.table.column = value

But I have to manipulate a table which is storing a relation between categories an news records. I don't have an idea how to do that:

TCAdefaults.sys_category_record_mm.uid_foreign = 3 (-> where field tablename is "tx_news_domain_model_news" or something like that)

Thanks and thanks for reading my bad english :-)

Upvotes: 1

Views: 1118

Answers (1)

HR123
HR123

Reputation: 708

It's much easier than you think ;-)

TYPO3 creates automaticly the relation. You have only to set the correct table of the tx_news record and the correct category field.

Here's an example for you:

TCAdefaults.tx_news_domain_model_news.categories = 1

The table of a tx_news record is "tx_news_domain_model_news" the field for the categories just named "categories". The ONE (1) is the UID of the sys_category record.

I've tested it on an 7.x TYPO3, and it works for me.

Upvotes: 4

Related Questions