Your First RSS Feed

100 %
0 %
Information about Your First RSS Feed

Published on September 29, 2007

Author: Peppar


Your First RSS Feed:  Your First RSS Feed Lori Packer Web Editor University of Rochester   What is RSS? :    What is RSS? RSS feeds (sometimes referred to XML feeds) are updated lists of headlines and articles that you can subscribe to and read using a free software application called a feed reader or aggregator. What is RSS?:  What is RSS? RSS feeds (stands for "Real Simple Syndication" or "Rich Site Summary, depending on who you ask) allow you to gather all the news you are interested in from a variety of sources in one place, with updates sent to you automatically throughout the day. Creating customized RSS feeds from search strings:  Creating customized RSS feeds from search strings There are also several Web sites that allow you to create your own custom RSS feed based on a particular search string or query. For example, you could create a RSS feed for your university’s name, or a particular research term that interests you. Creating customized RSS feeds from search strings:  Creating customized RSS feeds from search strings Daypop ( Topix ( FindArticles ( Creating Your First RSS Feed:  Creating Your First RSS Feed Some content management systems will generate feeds for you, and there are several RSS-creation tools (both free and not-so-free) available. But even without these tools, it’s easy to create an RSS feed yourself. There are two basic ways to approach your first RSS feed: you can bake it from scratch or connect to a database. Bake it From Scratch :  Bake it From Scratch All RSS feeds are in XML format. XML is a markup language, and as such it looks very similar to HTML; it uses tags to “mark up” content. But unlike HTML, in XML you can make up your own tags, and these tags don’t control the presentation or “look” of a site. They simply define and describe your content. Bake it From Scratch:  Bake it From Scratch With a few simple steps, you can create your first RSS feed from scratch. All you need is a text editor (eg. Notepad) and some compelling, frequently updated Web content. Bake it From Scratch:  Bake it From Scratch Declare the RSS version you’re using (2.0 is the latest) with the <rss> tag Use the <channel> tag to begin your feed Use the <title>, <description>, and <link> tags to describe your feed as a whole (there are other optional tags that apply to your feed as a whole, like <copyright>, <image>, and <webMaster>) Bake it From Scratch:  Bake it From Scratch Start each item with the <item> tag Within each item, add a <title>, <description>, and <link> End each item with </item> End your feed with </channel> End your file with </rss> Save your files as an XML file (eg. sciencenews.xml) Slide11:  <rss version="2.0"> <channel> <title>University of Rochester : Humanities and Social Science Releases</title> <description>Updated news from University Public Relations</description> <link></link> <copyright>Copyright 2005 : University of Rochester</copyright>   <image> <title>University of Rochester News</title> <url></url> <link></link> </image> <item> <title>University Celebrates 20th Anniversary of Annual Viennese Ball</title> <description>The Viennese Ball, one of the University of Rochester&#39;s most popular annual events, will be held from 9 p.m. to midnight on Saturday, Nov. 12, in Wilson Commons on the University&#39;s River Campus.</description> <link></link> <pubDate>Fri, 28 Oct 2005 00:00:00 EDT</pubDate> </item> <item> <title>Talk on China&#39;s role in global business by David McHardy Reid</title> <description>International business expert and strategist David McHardy Reid will discuss China&#39;s past 25 years of economic progress and how it may affect the future of global business at 2 p.m. Sunday, Nov. 13, in the Welles-Brown Room of Rush Rhees Library.</description> <link></link> <pubDate>Thu, 27 Oct 2005 00:00:00 EDT</pubDate> </item> </channel> </rss> That’s it! :  That’s it! Now upload your .xml file to your server and subscribe to your feed using your feed reader. Voila! Connect to a Database :  Connect to a Database Of course, it’s easy enough to create a feed like the one above. The trouble comes with maintaining and updating it. If you create your feed from scratch, you’ll be adding new items from scratch too. That can get very tedious very quickly. Connect to a Database :  Connect to a Database For folks whose Web content is already in a database, there’s good news. You can use PHP to generate your RSS feed automatically. Whenever a new item is added to your database, its entry is automatically added to your feed. Connect to a Database:  Connect to a Database Follow these steps: (as outlined in an excellent article from the excellent Create the .htaccess file First, you need to create or update your .htaccess file to tell the server to treat .xml files like PHP. Add this line to your .htaccess file: AddType application/x-httpd-php .xml All the .xml files in that directory will be treated as PHP. Connect to a Database:  Connect to a Database Set the header Use the header() function to make sure your PHP send the text in your feed as XML and not HTML. Enter this line of code at the top of your file: <? header('Content-type: text/xml'); ?> Connect to a Database:  Connect to a Database Declare the RSS version your using (2.0 is the latest) with the <rss> tag Use the <channel> tag to begin your feed Set the basic feed using the same <title>, <description>, and <link> tags as you would if you were baking from scratch. Connect to a Database:  Connect to a Database Retrieve the items from your database First, you need to write a mySQL query that grabs the items you want to include in your feed. <? $getItems = "SELECT refno, headline_press_release, body, UNIX_TIMESTAMP(publication_date) AS pubDate FROM releases WHERE live = 1 AND subject_humansocial = 1 ORDER BY publication_date DESC LIMIT 10"; $result = mysql_query($getItems); ?> This query grabs the reference number, headline, body text, and publication date for the most recent 10 releases with a category of “humanities and social sciences” and lists them in descending order by date. Connect to a Database:  Connect to a Database Next, you need to store the query results in an array. The next piece of code looks like this: <? $num_rows = mysql_num_rows($result); if($num_rows !=0) { while ( $myrow = mysql_fetch_array($result) ) { $refno = $myrow["refno"]; $headline_press_release = $myrow["headline_press_release"]; $body=strip_tags($myrow['body']); $body=substr($myrow10['body'],0,300); $publication_date = strftime("%a, %d %b %Y %T %Z",($myrow["pubDate"])); ?> Connect to a Database:  Connect to a Database Build the feed Finally, you need to build the actual feed. In other words, you need to format the title, description, and link for each of the items you’ve grabbed from your database. That code looks like this: <item> <title><?print htmlspecialchars($headline_press_release,ENT_QUOTES);?></title> <description><?print htmlspecialchars($body,ENT_QUOTES);?></description> <link><?print $refno;?></link> <pubDate><?print $publication_date;?></pubDate> </item> <? } } else { ?> <p>No recent Press Releases found.</p> <? } ?> Connect to a Database:  Connect to a Database End your feed with </channel> End your file with </rss> Save your files as an XML file (eg. sciencenews.xml) Feed Readers :  Feed Readers A feed reader or aggregator is a software program that you can download and then use to read your RSS feeds. There are also some Web-based feed readers that work inside your existing Web browser. Feed Readers:  Feed Readers Each feed reader is slightly different, but most have the same basic components: A list of feeds you're currently subscribed to, a list of headlines from the selected feed, and the full text of the selected item or headline. Feed Readers:  Feed Readers Feed Readers:  Feed Readers Feedreader (Windows only) — a nice, simple, free news reader that supports all formats of RSS feeds. SharpReader (Windows only) — a more full-featured news reader that supports all RSS formats. RSSreader (Windows only) — another simple RSS reader that supports all major formats. NewsGator (Windows only) — a more full-featured news reader that can be accessed either over the Web or integrated with Microsoft Outlook. NewsFire (Mac) — offers a simple interface and integration with iTunes for simple podcasting (the audio equivalent of RSS feeds). AmphetaDesk (Mac or Windows) — a free application that downloads your feeds and displays them in a customizable Web page. MyYahoo! — a Web-based news aggregator built into Yahoo!'s popular portal. Feed Searches :  Feed Searches So where do you find RSS feeds? The most common way is to look for the orange-and-white graphics on Web pages that provide RSS feeds of their content ( or ). Click on the graphic to find the URL and enter that URL into your reader. Feed Searches:  Feed Searches Most major news sites from traditional media outlets (New York Times, CNN, BBC, USA Today, NPR, Newsweek, and many many more) now offer RSS feeds. You can also search for RSS feeds using several online directories: Yahoo! News Feedster Search 4 RSS

Add a comment

Related presentations

Related pages

HOW TO: Getting Started with RSS —

HOW TO: Getting Started with RSS. RSS has become a valuable technology for everything from casual web users to webmasters. According to a recent Yahoo ...
Read more

RSS Feed Reader, your tool for saving time and money at ...

Lightweight & Mobile-Ready RSS Reader. Simple Feed Import and Export; Sort and organize your subscriptions, news, alerts, shopping deals and more
Read more

Using WordPress RSS Feeds | Elegant Themes Blog

Managing a WordPress RSS Feeds. WordPress publishes all of your blog posts to an RSS feed. Pages, and custom post types, are not included. WordPress gives ...
Read more

History of RSS

History of RSS. RSS was first invented by Netscape. They wanted to use an XML format to distribute news, stories and information.
Read more

Create your first RSS feed consumer In .Net | [Code ...

Introduction: What is RSS Feeds: RSS known as rich site summary or real simply syndication, which allow you to be updated with content of other ...
Read more

What is RSS? - @ProBlogger - Blog Tips to Help You Make ...

What is RSS? I’m regularly ... How to Use RSS. Get an RSS Reader – The first thing you’ll want to do if ... Many sites also enable you to subscribe ...
Read more

Subscribe to an RSS Feed - Outlook

Subscribe to an RSS Feed. Really Simple Syndication (RSS) provides an easy way for you to read the latest postings to your favorite Web sites. Many Web ...
Read more

What is RSS? How to use RSS in WordPress?

Wondering what is RSS and how you can use it to save time? Read this easy to understand article that explains what is RSS in plain English.
Read more

RSS - Wikipedia, the free encyclopedia

RSS feeds enable publishers to syndicate data automatically. ... the first version of RSS, was created by Dan Libby and Ramanathan V. Guha at Netscape.
Read more