Search code examples
typo3tx-newstypo3-10.x

TYPO3: filter tx_news categories by arguments in the URL


I have a website with TYPO3 v10 and tx_news. I like to know if it is possible to filter categories with arguments in URL something like:

 www.mywebsite.com/index.php?id=9&tx_news_pi1%5Bnews%5D=350&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=list&categories=12

In this example the link will lead to a page where all news items belong to category id=12.

Thanks for any hints.


Solution

  • Yes this is possible by adding the parameter in a form that its handed over to the plugins extbase controller. For tx_news the parameter you ask for looks like:

    &tx_news_pi1[overwriteDemand][categories]=12
    

    You can even make the parameters shorter and more readable by using RouteEhancers in your site: https://docs.typo3.org/p/georgringer/news/8.5/en-us/AdministratorManual/BestPractice/Routing/Index.html