Search code examples
typo3typo3-7.6.xtx-news

Map tt_news links to work with tx_news extension in TYPO3


I'm using tx_news with imported news entries from tt_news. The import worked well, but some news contain "old" links in the body field of this form

/index.php?id=10&tx_ttnews[tt_news]=123&tx_ttnews[mode]=single&tx_ttnews[backPID]=2&no_cache=1

Can these links be "mapped" somehow to work with tx_news?

Using Typo3 7.6.12


Solution

  • In short, this is not possible. However there are several options I am thinking of. In general those links should be defined by using the EXT:linkhandler

    1) Convert manually: Sounds sad but if not too many links are there, it is certainly the fastest one.

    2) Use one of the hooks of TYPO3 which are used during the bootstrapping and do custom redirects. E.g. $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'].

    3) Hook into the error handling and redirect right before showing any error page. One example to check out could be an ext I did: https://github.com/georgringer/fast_redirect. It must be certainly modified to fit your needs.


    What you can actually do as well, which I did for a big import a while ago: Remove all news records again, truncate the table and use any PHP script and fill up the table tx_news_domain_model_newswith the same amount of news entries found in tt_news and set the uid to the one of tt_news and set the import_source field to TT_NEWS_IMPORT and the import_id field as well to the uid of the tt_news uid. After that, the import will pick the dummy tx_news_domain_model_news record, found by findOneByImportSourceAndImportId() and will enrich it with the regular data. You will end with news records having the same uid.