Thread: Rss?
View Single Post
  #14 (permalink)  
Old 23-04-2008, 06:21 AM
skunkbad's Avatar
skunkbad skunkbad is online now
Member
 
Join Date: Apr 2008
Location: Temecula, California, USA
Posts: 86
Default

Quote:
Originally Posted by SidekickWD View Post
I'm probably not calling it by the right name, or something, but what I need for a clients site seems simple and I cannot figure it out.

I need to create a way for news feeds from other sources to automatically load onto my clients page and refresh every day.

I've seen it on other websites, but I can't figure out how to do it. Any help out there?

~B
If you know a little php, you can make your own, which is usually customized depending on the XML or RDF that is being fed. An RSS feed is nothing but XML, and XML is easily parsed and output using php's built in SimpleXML class, or if you don't have php5, there are many classes to parse XML in php4.

For instance, here is some code I came up with that imports a daily bible verse from an RSS feed:

PHP Code:
                print("<div class='greenbox-top'></div>
                    <div class='greenbox-bg'>
                    <h2>Verse Of The Day</h2>"
);
                        
$feed simplexml_load_file('http://www.biblegateway.com/usage/votd/rss/votd.rdf?9');
                        
$namespaces $feed->getNamespaces(true);
                        
$content $feed->channel->item->children($namespaces['content']);
                        
$verse $feed->channel->item->title;
                        echo (
"<p>".$verse."".str_ireplace('<br/><br/> Brought to you by <a href="http://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) KJV. All Rights Reserved.','',$content->encoded)."</p>");
                    print(
"</div>
                <div class='greenbox-bottom'></div>"
); 
__________________
Brian's Web Design - Temecula

Last edited by skunkbad; 23-04-2008 at 06:22 AM. Reason: formatting got messed up
Reply With Quote