In my component I am assigning the data from the model to the view using
class FileUploaderViewFileUploader extends JViewLegacy
// Overwriting JView display method
function display($tpl = null)
// Assign data to the view
$this->items = $this->get('Items'); // => This causes the error
// Display the view
The error at my website I get is:
Using $this when not in object context
Anybody an idea what happened here? This code worked well under PHP 5.6.x as well as PHP 7.0.26.
Thank you in advance.
Are you sure the error is coming from that line? If so, you may want to review your model's getItems method (include it also in your question for review). Likely you might be calling a static method somewhere, where you can't use
Also, what is your Joomla version - is it up-to-date? Have you just updated Joomla? Are you sure the update went smoothly? Note that this error might be coming from anywhere... e.g. a plugin, or core code if an update didn't completed successfully.
Enable error reporting and debug and see what else information you get from there.
Found the issue. I called
JSite in my model.
I changed it to:
$app = JFactory::getApplication(); $menu = $app->getMenu();
This fixed the issue.