theme_aggregator_page_item

Versions
4.6 – 5
theme_aggregator_page_item($item)

Format an individual feed item for display on the aggregator page.

Related topics

Code

modules/aggregator.module, line 1091

<?php
function theme_aggregator_page_item($item) {
  static $last;

  $date = format_date($item->timestamp, 'custom', 'Ymd');
  if ($date != $last) {
    $last = $date;
    $output .= '<h3>'. format_date($item->timestamp, 'custom', 'F j, Y') ."</h3>\n";
  }

  $output .= "<div class=\"news-item\">\n";
  $output .= ' <div class="date">'. format_date($item->timestamp, 'custom', 'H:i') ."</div>\n";
  $output .= " <div class=\"body\">\n";
  $output .= '  <div class="title"><a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a></div>\n";
  if ($item->description) {
    $output .= '  <div class="description">'. $item->description ."</div>\n";
  }
  if ($item->ftitle && $item->fid) {
    $output .= '  <div class="source">'. t('Source') .': '. l($item->ftitle, "aggregator/sources/$item->fid") ."</div>\n";
  }

  $result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid);
  $categories = array();
  while ($category = db_fetch_object($result)) {
    $categories[] = l($category->title, 'aggregator/categories/'. $category->cid);
  }
  if ($categories) {
    $output .= '  <div class="categories">'. t('Categories') .': '. implode(', ', $categories) ."</div>\n";
  }

  $output .= " </div>\n";
  $output .= "</div>\n";

  return $output;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.