PDA

View Full Version : What is RSS? XML?



richkoi
11-11-2005, 01:42 PM
I see the little RSS buttons everywhere now. I click on them... and I see what looks like HTML code. I research it further and find there are RSS readers. I've even heard something about iPOD reading RSS feeds. I am assuming this is some standardized coding that allows users with RSS readers to view updated content from websites that have these feeds.

However, I can't seem to find a straight answer on what this is. If it is what I think it is, it sounds like it would be useful to incorporate into information sites where content is updated regularly. I even found a PHP generator for RSS feeds that seems pretty simple to implement. http://usefulinc.com/rss/rsswriter/

Help me understand what RSS/XML is and what potential it holds.

Thanks,

Rich

dharrison
11-11-2005, 02:31 PM
Mmm. This brings back memories. I felt this way a couple of weeks ago.

You assume correctly. RSS Feeds can be anything from latest bits of news, latest entries on blogs daily cartoons and so on. RSS can be read as Email or on a web browser.

I cannot vouch for the email one, but I went to http://www.bloglines.com/ and signed up for an account.

Then when you go to a site and decide you want to subscribe to their RSS feed (eg BBC World News), You click the orange button and follow the instructions from there. When you get the Coded page, copy and paste the URL into your blog reader in the appropriate form field (Labelled blog or feed URL).

You then check on it whenever you feel like it and get all the latest info.

I use mine for Latest News and F1 news. If theres an RSS feed for Gary Larson Cartoons, I wanna know about it.

As for Ipod/PHP, sorry don't know.

HTH regardless

richkoi
11-11-2005, 03:10 PM
I am using Google's reader. (http://www.google.com/reader) So far I love it.

Now... I am going to try to create my own RSS feed.

Rich

richkoi
11-11-2005, 03:29 PM
There are thousands of articles on how to build a reader (aggregator?)...

but how about a writer(?)? In PHP?

What I would like to do is create a chunk of PHP code that takes my blog posts (title, desc, date, etc) and generates a XML file out of it. Any tutorials out there? Scripts?

Rich

richkoi
11-11-2005, 03:51 PM
Could I simply do this?


−<rss version="2.0">
−<channel>
<title>Blog Title</title>
<link>http://www.blogurl.com</link>
<description>RSS feed for Blog Title</description>
<? //PHP database code ?>
−<item>
<title><? echo $title; ?></title>
-<link><? echo $url; ?></link>
<pubDate><? echo $date; ?></pubDate>
−<description><? echo $post; ?></description>
</item>
<? //end database code ?>
</channel>
</rss>

...or am I missing something?

Rich

wsmeyer
11-11-2005, 06:05 PM
I haven't done it for an RSS feed but I did make my Google sitemap.xml dynamic using PHP scripting.

I had to add .xml to my .htaccess file to get it to prse PHP and then have it print the xml header like this:


<? header('Content-type: text/xml'); ?>
<?php print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>
<?php print "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\" >"; ?>

William.

imported__sam_
11-12-2005, 01:28 PM
Hello Rich,


Could I simply do this?


...

...or am I missing something?

Rich

That's it, as simple as that. Just read the RSS specification at http://blogs.law.harvard.edu/tech/rss (but you seemingly did this already), generate the mandatory fields and whatever of the optional fields you find useful.
I did this for a site at http://www.snap-scan.com/us_pl.html and it's quite straightforward.

best regards

Sam

richkoi
11-14-2005, 01:48 PM
I figured it out in php... except I want to display it with the .xml extension. Unfortunately my host does not allow .htaccess extension changes, so I'm at a loss.

Rich

wsmeyer
11-14-2005, 05:43 PM
Unfortunately my host does not allow .htaccess extension changes

That's lame.

The only other way I can think of is using a cron job to rewrite your .xml file periodically but I'm not sure how often you would want to run it.

William.