我在同一页面上有 tx_news 的列表视图和详细视图插件。当我进入没有 news-id 参数的页面时,我想显示最新的新闻记录。有没有办法做到这一点?
我发现这里拒绝了对此的功能请求:https ://forge.typo3.org/issues/67012
我在同一页面上有 tx_news 的列表视图和详细视图插件。当我进入没有 news-id 参数的页面时,我想显示最新的新闻记录。有没有办法做到这一点?
我发现这里拒绝了对此的功能请求:https ://forge.typo3.org/issues/67012
The solution is contained within the documentation. I did not find it there until I had figured out most of it myself and was looking for a specific method that I needed (useStdWrap). Here it is:
# TS SETUP:
plugin.tx_news.settings {
overrideFlexformSettingsIfEmpty = singleNews,cropMaxCharacters,dateField,timeRestriction,orderBy,orderDirection,backPid,listPid,startingpoint
useStdWrap = singleNews
singleNews.stdWrap.cObject = CONTENT
singleNews.stdWrap.cObject {
table = tx_news_domain_model_news
select {
max = 1
orderBy = datetime
# ENTER PID OF YOUR NEWS RECORDS HERE
pidInList = 3
}
renderObj = TEXT
renderObj.field = uid
}
}
This code does NOT include the possibility to filter by category and it OVERWRITES any existing configuration lists in overrideFlexformSettingsIfEmpty and useStdWrap.
If you need category filtering and/or want to be less destructive on the two configuration lists, here is an extended example:
# TS SETUP:
plugin.tx_news.settings {
overrideFlexformSettingsIfEmpty := addToList(singleNews)
useStdWrap := addToList(singleNews)
singleNews.stdWrap.cObject = CONTENT
singleNews.stdWrap.cObject {
table = tx_news_domain_model_news
select {
max = 1
orderBy = datetime
# ENTER PID OF YOUR NEWS RECORDS HERE
pidInList = 3
join = sys_category_record_mm ON (tx_news_domain_model_news.uid = sys_category_record_mm.uid_foreign)
# ENTER UID OF YOUR CATEGORY HERE (look it up in table sys_category)
where = sys_category_record_mm.uid_local = 2
}
renderObj = TEXT
renderObj.field = uid
}
}