Techno World Inc - The Best Technical Encyclopedia Online!

THE TECHNO CLUB [ TECHNOWORLDINC.COM ] => PHP => Topic started by: Daniel Franklin on September 26, 2007, 01:18:42 PM



Title: RSS Feeds – Adding a Feed to a Website Using PHP
Post by: Daniel Franklin on September 26, 2007, 01:18:42 PM
The method of adding RSS feeds discussed below involves the use of PHP and HTML. o

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

You can download the RSS2HTML package fromhttp://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*

< ?php include('http://www.yourserver.com/rss2html.php?XMLFILE=http://ww w.searchenginewatch.com/sew.xml&TEMPLATE=http://www.yourserver.or g/template1.html&MAXITEMS=20 target="_blank">'); ? >

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? Try the rss feed engines http://www.octora.com orhttp://www.bloglines.com

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

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.

Article Source: http://EzineArticles.com/?expert=Kevin_Allman