Search code examples
typo3typoscripttypo3-9.xtx-news

TYPO3 tx_news entries within a date range


I am currently migrating tt_news to news. The old news system also has news-entries shown as events. Is it somehow possible to hide entries that are past, without having to archive those? Or else to show only entries within the next x days?

This was possible with tt_news typoscript:

extensions.ttnews_selectconf {
    andWhere (
        tt_news.datetime < (UNIX_TIMESTAMP() +604800)
        AND tt_news.datetime > (UNIX_TIMESTAMP()-86400)
    )
}

I could not find anything in the news docs.


Solution

  • The news extension has a TypoScript option to set a minimum date/time: https://docs.typo3.org/typo3cms/extensions/news/stable/AdministratorManual/Configuration/TypoScript/Index.html#timerestriction

    So plugin.tx_news.settings.timeRestriction = now will show news items starting now. plugin.tx_news.settings.timeRestriction = today will show news items starting at the start of today.

    For a maximum date you can use timeRestrictionHigh

    Also, if you're using news for events, you might want to check out the eventnews extension. This extends the news extension to add fields and views that are useful for events. https://extensions.typo3.org/extension/eventnews