You are here

function aggregator_page_category in Drupal 6

Same name and namespace in other branches
  1. 4 modules/aggregator.module \aggregator_page_category()
  2. 5 modules/aggregator/aggregator.module \aggregator_page_category()
  3. 7 modules/aggregator/aggregator.pages.inc \aggregator_page_category()

Menu callback; displays all the items aggregated in a particular category.

If there are two arguments then this function is called as a form.

Parameters

$arg1: If there are two arguments then $arg1 is $form_state. Otherwise, $arg1 is $category.

$arg2: If there are two arguments then $arg2 is $category.

Return value

The items HTML.

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

File

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

Code

function aggregator_page_category($arg1, $arg2 = NULL) {

  // If there are two arguments then we are called as a form, $arg1 is
  // $form_state and $arg2 is $category. Otherwise, $arg1 is $category.
  $category = is_array($arg2) ? $arg2 : $arg1;
  drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get('site_name', 'Drupal') . ' ' . t('aggregator - @title', array(
    '@title' => $category['title'],
  )));

  // It is safe to include the cid in the query because it's loaded from the
  // database by aggregator_category_load.
  $items = aggregator_feed_items_load('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 = ' . $category['cid'] . ' ORDER BY timestamp DESC, i.iid DESC');
  return _aggregator_page_list($items, arg(3));
}