4.7.x aggregator.module aggregator_page_rss()
5.x aggregator.module aggregator_page_rss()
6.x aggregator.pages.inc aggregator_page_rss()
7.x aggregator.pages.inc aggregator_page_rss()

Menu callback; generate an RSS 0.92 feed of aggregator items or categories.

1 string reference to 'aggregator_page_rss'
aggregator_menu in modules/aggregator/aggregator.module
Implementation of hook_menu().

File

modules/aggregator/aggregator.pages.inc, line 321
User page callbacks for the aggregator module.

Code

function aggregator_page_rss() {
  $result = NULL;

  // arg(2) is the passed cid, only select for that category
  if (arg(2)) {
    $category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2)));
    $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, i.iid DESC';
    $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10));
  }
  else {
    $category = NULL;
    $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC';
    $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
  }
  $feeds = array();
  while ($item = db_fetch_object($result)) {
    $feeds[] = $item;
  }
  return theme('aggregator_page_rss', $feeds, $category);
}