You are here

function biblio_recent_feed in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 biblio.module \biblio_recent_feed()
  2. 6 biblio.module \biblio_recent_feed()
  3. 7.2 biblio.module \biblio_recent_feed()
1 string reference to 'biblio_recent_feed'
biblio_menu in ./biblio.module
Implements hook_menu().

File

./biblio.module, line 2047
Bibliography Module for Drupal.

Code

function biblio_recent_feed() {
  $numberInFeed = variable_get('biblio_rss_number_of_entries', 10);
  $query = db_select('node', 'n')
    ->fields('n', array(
    'nid',
    'title',
  ))
    ->condition(db_and()
    ->condition('n.type', 'biblio')
    ->condition('n.status', 1))
    ->orderBy('n.created', 'DESC')
    ->range(0, $numberInFeed);
  $result = $query
    ->execute();
  $siteName = variable_get('site_name', 'Drupal');
  $base = variable_get('biblio_base', 'biblio');
  $channel['title'] = $siteName . ' - ' . t("Recently Added Publications");
  $channel['link'] = url($base, array(
    'absolute' => TRUE,
  ));
  $channel['description'] = t("This feed lists the %num most recently added publications on %site", array(
    '%num' => $numberInFeed,
    '%site' => $siteName,
  ));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row->nid;
  }
  node_feed($nids, $channel);
}