My fix to`0 – Using $this not in object context` in Joomla!
After migrating, the Joomla! page would not show up. Instead, only the error “0 – Using $this not in object context” was showing up. In my case, I was able to fix the issue by replacing – in the code of the template – all JFactory::getMenu() with $application->getMenu(), where $application came from $application = JFactory::getApplication(). […]