Same name and namespace in other branches
  1. 4.7.x modules/aggregator.module \aggregator_page_rss()
  2. 5.x modules/aggregator/aggregator.module \aggregator_page_rss()
  3. 6.x modules/aggregator/aggregator.pages.inc \aggregator_page_rss()

Page callback: Generates an RSS 0.92 feed of aggregator items or categories.

Return value

string An HTML formatted string.

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

File

modules/aggregator/aggregator.pages.inc, line 404
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_query('SELECT cid, title FROM {aggregator_category} WHERE cid = :cid', array(
      ':cid' => arg(2),
    ))
      ->fetchObject();
    $result = db_query_range('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 = :cid ORDER BY timestamp DESC, i.iid DESC', 0, variable_get('feed_default_items', 10), array(
      ':cid' => $category->cid,
    ));
  }
  else {
    $category = NULL;
    $result = db_query_range('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', 0, variable_get('feed_default_items', 10));
  }
  $feeds = $result
    ->fetchAll();
  return theme('aggregator_page_rss', array(
    'feeds' => $feeds,
    'category' => $category,
  ));
}