Common RSS Reader

This library holds only a single function that is able to display any feed in any format.
The URL of the file may be local, in the form: rss.xml, or remote in the form: http://www.xul.fr/rss.xml.
The function displays the channel and the articles and for each of them the title, the description and the dates.

The date is not displayed for the RSS RDF 1.0 format because it is not a part of the core specification.

The script is compatible with:

The interface

The interface is comprised of a single function:

Common_Display(url, size, channel-option, desc-option, date-option)

The interface requires one argument, the url, and supports four optional arguments:

  1. url:
    the address of the XML file.
  2. size:
    the maximum number of items to display. The default is 25.
  3. channel-option:
    true if the chanel is displayed, false elsewhere. Default true.
  4. desc-option:
    true if the descriptions are displayed or else false. Default true.
  5. date-option:
    true if the dates are displayed or else false. Default false.

Source code

The source is a combination of the Atom and RSS readers. Main internal functions are these:

Atom_Retrieve()        // parse the feed element and its entries.
RSS_Retrieve()         // parse the channel element and its items.
View the commonlib.php script.

Demos

Demos are templates you can study and use on you own site, according to the Mozilla licence. A form allows to enter the URL of the feed. You can remove the form and replace it by a direct URL of a feed. The feed may be displayed into the same page or into another one.

Download

The archive holds the script and the demos.

Documentation


(c) 2007 Denis Sureau. Scriptol.com
Licence: Mozilla 1.1.