Page 1 of 1

Why RSS runs slowly?

Posted: Wed Feb 04, 2009 10:42 pm
by morris520
Hi, just a general question uncertain.

I am reading a rss feed from my blog, displaying the topics on index page. But then my index page takes longer to load? why?

Just thinking can AJAX help?

My original design was to display the topics on a pop-out layer when user clicks a button.

Please give some general advice to avoid the time on loading. Thanks

Re: Why RSS runs slowly?

Posted: Wed Feb 04, 2009 10:43 pm
by Benjamin
Is it pulling the feed from a remote server, your database or from a cache?

Re: Why RSS runs slowly?

Posted: Wed Feb 04, 2009 11:51 pm
by morris520
I think my code reads from the remote server, e.g. bbc server.

Time maybe spent on loading data from it.

If not possible to reduce the time can I write a loading bar or similar to tell user when the loading finishes ?

Re: Why RSS runs slowly?

Posted: Wed Feb 04, 2009 11:58 pm
by Benjamin
It would probably be easiest for you to save the feeds locally and serve them from your server. You can refresh them every 10 minutes or so.

Re: Why RSS runs slowly?

Posted: Thu Feb 05, 2009 11:34 am
by morris520
This is the code I called when the button on index page is clicked. Is this called locally?

Code: Select all

 
function writePost(){
    $myMsnRss = 'http://morris520blog.spaces.live.com/feed.rss';
    //$titleArray[] = array();
 
    $doc = new DOMDocument;
    $doc->load($myMsnRss);
 
    for($i=1;$i<=$doc->getElementsByTagName('title')->length;$i++)
    {
        $topic = $doc->getElementsByTagName('title'); 
        $link = $doc->getElementsByTagName('link'); 
        $titleArray[$topic->item($i)->nodeValue] = $link->item($i)->nodeValue;
        //echo 'content: '.$topic->item($i)->nodeValue."<br/>";
    }
    
    return $titleArray;
}