Strict Standards: Non-static method DOMDocument::load() rss feed

joomla3.0, php, rss, rss-reader

Solution

There is an example on the exact page you are referring to:

<?php
$doc = new DOMDocument();
$doc->load('book.xml');
echo $doc->saveXML();
?>

you can only call the "load" method on an instance; so you first need to create a `DOMDocument` instant, and then apply load on it.

In short, as @MichaelBerkowski proposed: use

$dom = new DOMDocument();
$rss = $dom->load($rss_feed_url);

Problem

I'm getting this error from several RSS feed joomla modules. (below is an example from one of them, LightRSSFeedReader, but I'm getting the issue on the others I have tried) ``` Strict Standards: Non-static method DOMDocument::load() should not be called statically in /mnt/data/vhosts/casite-395567.cloudaccess.net/httpdocs/modules/mod_LightRSSFeedReader/tmpl/default.php on line 40 Notice: Trying to get property of non-object in /mnt/data/vhosts/casite-395567.cloudaccess.net/httpdocs/modules/mod_LightRSSFeedReader/tmpl/default.php on line 48 ``` Line 40 reads: `$rss = DOMDocument::load("$rss_feed_url");` There is some discussion on the web to use "->" instead of "::" but simply changing it (in an override of course), but that just creates more errors. There is also something about getting the right code from http://php.net/manual/en/domdocument.load.php but I'm at a loss as to how that plays with the "$rss" variable. As you can tell, I'm not a PHP coder. Any help is widely appreciated.

Original source

Related problems