function theme_aggregator_page_rss in Drupal 6
Same name and namespace in other branches
- 7 modules/aggregator/aggregator.pages.inc \theme_aggregator_page_rss()
Theme the RSS output.
Parameters
$feeds: An array of the feeds to theme.
$category: A common category, if any, for all the feeds.
Related topics
1 theme call to theme_aggregator_page_rss()
- aggregator_page_rss in modules/
aggregator/ aggregator.pages.inc - Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
File
- modules/
aggregator/ aggregator.pages.inc, line 352 - User page callbacks for the aggregator module.
Code
function theme_aggregator_page_rss($feeds, $category = NULL) {
drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
$items = '';
$feed_length = variable_get('feed_item_length', 'teaser');
foreach ($feeds as $feed) {
switch ($feed_length) {
case 'teaser':
$teaser = node_teaser($feed->description);
if ($teaser != $feed->description) {
$teaser .= '<p><a href="' . check_url($feed->link) . '">' . t('read more') . "</a></p>\n";
}
$feed->description = $teaser;
break;
case 'title':
$feed->description = '';
break;
}
$items .= format_rss_item($feed->ftitle . ': ' . $feed->title, $feed->link, $feed->description, array(
'pubDate' => date('r', $feed->timestamp),
));
}
$site_name = variable_get('site_name', 'Drupal');
$url = url(isset($category) ? 'aggregator/categories/' . $category->cid : 'aggregator', array(
'absolute' => TRUE,
));
$description = isset($category) ? t('@site_name - aggregated feeds in category @title', array(
'@site_name' => $site_name,
'@title' => $category->title,
)) : t('@site_name - aggregated feeds', array(
'@site_name' => $site_name,
));
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$output .= "<rss version=\"2.0\">\n";
$output .= format_rss_channel(t('@site_name aggregator', array(
'@site_name' => $site_name,
)), $url, $description, $items);
$output .= "</rss>\n";
print $output;
}