Displaying an Atom Feed

To complete the article "Displaying an RSS feed", this page explaine how to display a feed in the Atom format.
The URL of the file may be local, in the form: rss.xml, or distant in the form: http://www.xul.fr/rss.xml.

The script is compatible with:
- Atom 1.0

The interface

The interface is comprised of two functions:

Atom_Display()

For displaying a complete feed with the feed, the titles linking to articles and the subTitle for the feed or summary for each article.

Atom_Links()

For displaying only the list of titles linking to articles.

Source code

The source is simpler than the RSS version because there is only one feed while RSS (RDF) allows for multiple channels. Internal functions are these:

Atom_Retrieve(url)            // get the feed element and call Atom_Feed.
Atom_Feed(channel)    // extract data for the feed and call Atom_Tags for each item.
Atom_RetrieveLink(url)     // extract items for a fee and call Atom_Tags for each one.
Atom_Tags(item)            // extract title, link, summary for an article.
View the atomlib.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 the URL of a feed. The Atom feed may be displayed on the same page or another one.

Download

The archive holds the script and the demos.

Documentation


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