0

I am using tx_news with categories. Now I would like to have pages with url to each category like mypage.de/category/category1. On this page I see all news with category1.

I started with routing. According to https://docs.typo3.org/p/georgringer/news/10.0/en-us/Tutorials/BestPractice/Routing/Index.html I added the part in "Basic setup (including categories, tags and the RSS/Atom feed)" into my site.yaml.

This works, when I use a fluid template for the detail view to list all categories:

<f:for each="{newsItem.categories}" as="category" iteration="iteratorCategories">
  <f:link.action
      pageUid="{category.shortcut}"
      arguments="{overwriteDemand:{categories:category.uid}}"
      class="news-list-category__item"
      title="{category.title}">
    {category.title}
  </f:link.action>
</f:for>

I get a list of all associated categories, which are linked as preset in the yaml file.

When I click on the link I get an error:

(1/1) TypeError Return value of GeorgRinger\News\Controller\NewsBaseController::handleNoNewsFoundError() must be of the type string, null returned

What is going wrong?

I tried to find a full tutorial in the docs or in google but did not find anything

Is there somewhere a full tutorial for this?

How can I solve this?

Thank you, regards, Jürgen

Peter Kraume
  • 3,577
  • 2
  • 21
  • 39

1 Answers1

0

\NewsBaseController::handleNoNewsFoundError() has three return-point.

Two of them are returning '' - a string.

So, there only the third left (line 51):

$standaloneTemplate = GeneralUtility::makeInstance(StandaloneView::class);
$standaloneTemplate->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($options[1]));
return $standaloneTemplate->render();

Not sure, when rendering returns null. But I would check the configuration around templates, their paths, and so on.

Julian Hofmann
  • 2,081
  • 1
  • 8
  • 16
  • Thank you for your hint. `pageUid="{category.shortcut}"` returned `null`. It is from a deprecated viewhelper. `{category.title}` is working – Jürgen König Jun 20 '23 at 12:44