Hello,
I upgraded my website from the 2.11 to 3.5 (news archive copied from the old database) and now wherever I have news item in news archive, where there is some text besides news-teaser I am getting error
Using $this when not in object context in /var/www/vhosts/***/httpdocs/system/modules/news/modules/ModuleNews.php on line 144
Well, I find this kind of topic regarding Listing module, where it was solved to support backward compatibility.
https://github.com/contao/core/commi...41501bcf937418
Is it possible to do something similar with NewsModule.php? On line 144 there is:
PHP Code:
// Compile the news text
else
{
$id = $objArticle->id;
$objTemplate->text = function () use ($id)
{
$strText = '';
$objElement = \ContentModel::findPublishedByPidAndTable($id, 'tl_news');
if ($objElement !== null)
{
while ($objElement->next())
{
$strText .= $this->getContentElement($objElement->current());
}
}
return $strText;
};
$objTemplate->hasText = (\ContentModel::countPublishedByPidAndTable($objArticle->id, 'tl_news') > 0);
}
I understand it has something with static and non-static functions, but it is far beyond my PHP knowledge.
Regards
Bookmarks