PHP function to display a feed in the Atom format

To complete the article "Displaying an RSS feed", this page explains how to display a feed in the Atom format.

The script is compatible with Atom 1.0, it could work with other versions.

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.

Download

The archive holds the script and the demos.

Documentation

Licence: Mozilla 1.1.