Reprints Online

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: RSS feeds - Adding a Feed to a Website Using PHP


Guru

Status: Offline
Posts: 1465
Date:
RSS feeds - Adding a Feed to a Website Using PHP
Permalink  
 


Adding an rss feed to your website is not as difficult as most people believe. The great thing about adding RSS feeds to your website is that the feed can keep your page content updated automatically since you are 'streaming' information directly from another website to your page!

The method of adding RSS feeds discussed below involves the use of PHP and HTML.

To get started with streaming an RSS feed, you need to download a package called RSS2HTML which makes it easy to add feeds to your website.

You can download the RSS2HTML package from http://www.feedforall.com/download/ Once the files are unzipped, upload the php file rss2html.php to your server.

RSS2HTML uses templates to define how the news feed should be displayed, so you will also have to upload the template file included in the package to your server (template1.html). Once those files have been uploaded, loading an RSS file is easy!

Choose the HTML file you would like the RSS file to be loaded in, and rename the file to have an extension of .php instead of .htm Next, include the code snippet below in your new php file *MAKE SURE THAT THE CODE IS ON ONE LINE*

'); ?>

Let me explain what's going on in the code above; the first URL rss2html.php, is the path where you have uploaded your rss2html file;

the XMLFILE variable is the URL of the RSS news feed,

the TEMPLATE variable contains the URL of the template which defines how the news feed should be displayed. You can edit this in notepad if you want.

The MAXITEM variable defines how many items in the RSS feed should be displayed. (For more information about items in news feeds, consult the 'Making an RSS feed' article)

That's all there is to it! The php file should read the XML RSS file and display the contents using the template file.

As for where to find RSS feeds to add to your website? The main place I head to find RSS feeds is the Octora RSS feed search engine at http://www.octora.com You can type in a keyword; and hundreds if not thousands of feeds are usually produced for the keyword. Other places also include Bloglines and Technorati.

That said, go on and have fun adding feeds to your website!


About the Author
Kevin Allman is webmaster with over ten years Internet experience. He runs a Search Engine Optimization website at http://www.pzeta.org/seo_global/ which contains many articles on how to optimize your website. He also has been involved with search engine technology and has developed mini search engines throughout the past few years.



__________________
Build Your Own Software that also without code
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard