We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    hi folks,

    Im no noob to php...but this is wrecking my head. I have been using the NewsParserX snippet to get an rss feed from another website fine. Just recently the site went down and as a result my entire modx site just died with a big modx error.

    Now i’ve opened up the inc file and found the line that errors:

    function _load_file()
    {
    $data = @file($this->URL) or die ("Here is an error blah blah");
    return $data;
    }

    Now I know if I was using php 5 (and im not) I could surround it in a try and catch, and put out a "Feed unavailable" message, and stop the whole web page breaking. Can someone who is not a php dribbler like me help me out!!!

    Cheers,

    jus
    • All you should need to do is remove the "or die()" portion of that statement I believe, though you may also need to wrap the call to _load_file() in an if statement and test that the return value is what is expected.