codefog/contao-news_categories

"Could not find template" if article has custom template and RSS feed is generated

Closed this issue · 3 comments

If a news article contains a content element with a custom template in /templates/mytheme/ the template can't be found while generating the feed. If the template is placed directly in /templates it is working fine.
Contao itself had a similar issue: contao/contao#5552

Tested on Contao 4.13.29 with codefog/contao-news_categories 3.5.5.

Exception:
Could not find template "ce_text_test"

  at vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateLoader.php:156
  at Contao\TemplateLoader::getDefaultPath()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateLoader.php:112)
  at Contao\TemplateLoader::getPath()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:99)
  at Contao\Controller::getTemplate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:351)
  at Contao\Template->getTemplatePath()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:95)
  at Contao\Template->inherit()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:295)
  at Contao\Template->parse()
     (vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:43)
  at Contao\FrontendTemplate->parse()
     (vendor/contao/core-bundle/src/Resources/contao/elements/ContentElement.php:276)
  at Contao\ContentElement->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:622)
  at Contao\Controller::getContentElement()
     (vendor/codefog/contao-news_categories/src/FeedGenerator.php:151)
  at Codefog\NewsCategoriesBundle\FeedGenerator->generateFiles()
     (vendor/contao/news-bundle/src/Resources/contao/classes/News.php:105)
  at Contao\News->generateFeedsByArchive()
     (vendor/codefog/contao-news_categories/src/EventListener/DataContainer/FeedListener.php:109)
  at Codefog\NewsCategoriesBundle\EventListener\DataContainer\FeedListener->generateFeed()
     (vendor/codefog/contao-news_categories/src/EventListener/DataContainer/FeedListener.php:60)
  at Codefog\NewsCategoriesBundle\EventListener\DataContainer\FeedListener->onLoadCallback()
     (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:201)
  at Contao\DC_Table->__construct()
     (vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:416)
  at Contao\Backend->getBackendModule()
     (vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:168)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:49)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:44)

It should be fixed in 6712784. Can you hot-patch the changes and see if it works? Alternatively, you can upgrade the extension to version dev-master@dev. After you confirm the fix I will release a stable version.

Works fine, thanks.

Thanks, you can update to 3.5.6 stable then.