homepage Welcome to WebmasterWorld Guest from 54.197.110.151
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
Automatically create feeds for my blog-page?
yep, you guessed right, I'm a newbie ;)
atlibj

5+ Year Member



 
Msg#: 495 posted 8:03 pm on Feb 25, 2006 (gmt 0)

Well, I don't want to confuse you by mixing together all these terms that I'm not that familiar with so I'll just ask in plain english:

I have a personal blog page, created with PhP and using MySQL database. Since RSS is getting so popular I want to offer my friends and other visitors to add my blog to their RSS aggrigator, like My Yahoo and the upcoming Outlook 12 etc. etc.

I page include a few categories, like personal blogs, picture galleries and video clips and I like to make a separate RSS feed fo each of those categories.

What is the best way to do this?

 

Iguana

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 495 posted 9:51 pm on Feb 25, 2006 (gmt 0)

You already have the data in your database to provide the information. You need to write a php program to put the data out in this format:

<rss version="2.0">
<channel>
<title>Feed Title</title>
<link>http://www.mysite.com/blog.htm</link>
<description>Feed description</description>
<pubDate>Fri, 20 Jan 2006 23:23:51 GMT</pubDate>
<item>
<title>Post Title</title>
<description>Post entry</description>
<pubDate>Fri, 20 Jan 2006 23:23:51 GMT</pubDate>
</item>
</channel>
</rss>

I think ou also need to add this line in your .htaccess file
AddType application/x-httpd-php .xml

This tells the browser that any request for an f.xml file will be parsed as php. Your xml file is actually written in php. Your first page output needs to be

<? header('Content-type: text/xml');?>

Then put out the first bit of the rss. Loop around your posts and put out each <item></item>

Close the <channel> and <rss> tags and there you are.

atlibj

5+ Year Member



 
Msg#: 495 posted 11:27 pm on Feb 25, 2006 (gmt 0)

All right, I knew it had to be simple, but not all that simple ;)

So, I actually let the php code that "creates" the .xml file decide e.g. how many posts the feed should have and so on...? isn't that right?

And when the .xml file is complete, everybody that has an aggregator that support RSS 2.0 (or whatever I decide to use) should be able to use it just by linking to the file? (i.e. they don't need any other file or some info to use it, right?)

Iguana

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 495 posted 6:46 pm on Feb 26, 2006 (gmt 0)

Hi atlibj

Yes, you write the php so that it decides how many posts to put out.

The file produced will be able to be read by any rss 2.0 aggregator. Make sure that the files produced are valid xml (escape any odd characters such as umlauts) and away you go.

The reason why it is so simple is that you are going to write the php to output the feed. It only gets complicated when you are using third party products.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved