How To Publish Reviews As RSS Feeds
|
|
« Red Queen User Manual
|
Tutorial Table Of Contents
|
Obtain Red Queen »
PUBLISHING RSS FEEDSActivating An RSS FeedNow that you have created an RSS feed you need to publish it so that the world can gain access to it. Click on the Activate Feeds link in the navigation bar of the same page from which you have been working. This brings up a list of RSS feeds. Feeds that have been activated are represented as links that lead to the page displaying the published feed. For those not yet activated there is a checkbox to the right of each feed. Select the feed for activation, and click on Activate Selected Feeds at the bottom of the page. Follow the new link to the published feed to see what your visitors will be presented with. Of course, if your RSS feed is empty (because no reviews match the criteria used to select items for the feed) your visitors are going to feel cheated, so be sure to create feeds that have at least a few items in them. Each time a feed is activated (or deactivated) the RSS Syndication page is rewritten. This is a static page on your site that lists every activated RSS feed, and is the page to which visitors should be redirected in general when they are seeking information about RSS feeds on your site (or at least the RSS feeds generated by Red Queen). Every activated feed has its own XSL-formatted page, and links to the Syndication page. You can find the RSS feeds in the section of your document root that contains Red Queen documentation and images. In particular, look for the /rss subdirectory of your /redqueen directory. If you should need to remove an RSS feed from publication, simply deactivate it. You can then reactivate it at a later stage if needed. To destroy the RSS feed record itself, see the Remove Feed link in the navigation bar. Removing an RSS feed causes the feed information to deleted from the RSS table. Once a feed is activated it can be regularly updated by using the rss_reviews.pl script found in the /admin directory: perl reviews_rss.pl This will update ALL activated feeds on your site and rebuild the Syndication page. You might also want to set this script to run as a weekly cron job. Viewing An RSS FeedOnce you have created an RSS feed and published (i.e. activated it) it can be reached from the Syndication page on your site. Of course, plain RSS markup is not particulary human-friendly. If you send a reader to an RSS page and they aren't familiar with RSS markup they will likely think they are looking at a non-functional page on your site. It will seem like garbage to them. Instead, what you really want to do is present the information in an easy-to-digest format. There are several ways of going about the problem, but they all boil down to 2 steps. First you need to apply a parser to the RSS feed to extract the information it contains. Next you need to use a formatter to render that information in a manner that is easy to comprehend. Only two specific ways of going about this are discussed here, but they are the most commonly used methods of dealing with an RSS feed. The first method, outlined below, involves using a PHP script to do the work. The second method harnesses the ability of your browser to handle XSL instructions. The PHP method will appeal to anyone who likes the simplest solution, while the XSL method is for those who are up to the challenge of working with a somewhat complex markup syntax. Formatting An RSS Feed With PHPA handy utility for parsing RSS feeds is known as MagpieRSS. This RSS manipulation library can be incorporated into a simple PHP script that reads a specified RSS feed and makes the information in the feed accessible as a structured PHP array. If you know a little PHP, the rest is easy. Here are a couple of PHP scripts that, with some minor adjustments, can be used to parse the RSS feeds produced by Red Queen:
To use either of these scripts, simply call then in your browser address bar and add a query string paramter named url which specifies the path to the RSS feed to be parsed. For example review_items_rss.php?url=/some/path/to/redqueen/rss/some_named_rss_feed.xml The main line of code (found near the top of the file) that needs to be changed in each of these files to accomodate your own site is this one, which should specify your own domain: $rss_domain = 'http://www.mydomain.com'; These PHP scripts are very useful. You can handle them out to anyone who wants to add your feeds to their own website and, provided they have MagpieRSS installed, they scripts will work equally well for them, without any changes to the code. Formatting An RSS Feed With XSLAn alternative to using the PHP scripts discussed above is to use XSL--i.e. XML Style Language--markup language to format the feeds. How does this work? In each of the RSS feeds generated by Red Queen is a line of code that specifies the location of an XSL file. When a browser reads the RSS feed, it sees that an XSL file is also available and fetches it. It then uses the markup in the XSL file to generate the HTML needed to display the information in the feed in a nice way. So if you look at the top of any Red Queen-generated feed you will see a line like this: <?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/some/path/to/redqueen/rss/stylesheets/rss_stylesheet_item_review.xsl" ?> Because XSL is NOT a simple markup language, and requires some effort to master, it will not be discussed more fully here. The primary advantage to using an XSL stylesheet is that no work need be done on your server to render the feed. It is all done by the visitor's browser. A webmaster who wishes to syndicate your feeds can take a local copy of the XSL file, tweak it a little, and have it generate nicely-formatted pages for his visitors without having to install extra software, like MagpieRSS in order to use it. The disadvantage is the XSL learning curve. Next Section: CUSTOMIZING RSS FEEDS Copyright © 2004 Random Mouse Software. All Rights Reserved. | |||||||||