Skip to content
haschek edited this page Sep 9, 2012 · 2 revisions

Feed service class

The Feed service is the replacement of the original RSS and Atom service classes from Pubwich, it uses the very mature SimplePie feed API for PHP.

Configuration values

  • url: URI of the feed
  • contenttype: type of the feed, use application/rss+xml for RSS feeds and application/atom+xml for Atom feeds
  • link: the URI of the website the feed is used for

... and the basic configuration for all services.

Example configuration

$feed_rss = array(
        'Feed', 'feed_rss', array(
		'title' => 'Polly Blog Stew',
		'description' => 'Beastie Boys Fanblog',
		'url' => 'http://pollyblogstew.diving-robot.de/feed/',
		'contenttype' => 'application/rss+xml',
		'link' => 'http://pollyblogstew.diving-robot.de/',
		'cache_limit' => 12 * 60 * 60, // 12h
		'total' => 3,
	)
);

Template keys

  • link: URI of the feed item
  • title: the title string of the feed item
  • date: the date string of the feed item
  • summary: short summary of the feed item content, if existing
  • content: full content of the feed item, if existing
  • author: author of the feed item, if existing
  • category: category of the feed item, if existing
  • media_url: URI of the first media related to the feed item, if existing
  • media_thumbnail_url: URI of the thumbnail of the first media item, if existing
  • media_type:
  • media_caption: caption string of the first media item, if existing

Example template

function Feed_itemTemplate() {

    return '<li>
            <h3><a href="{{link}}">{{{title}}}</a> ({{{date}}})</h3>
            {{#media_thumbnail_url}}
                <img src="{{{media_thumbnail_url}}}" class="item-media-thumbnail" alt="{{{media_caption}}}" height="75" />
            {{/media_thumbnail_url}}
            {{#summary}}
                <p>{{{summary}}}</p>
            {{/summary}}
         </li>'."\n";

}