By bloggator on
So I'm trying to put a rss icon on each headline in my aggregator that will link back to the originating site's feed. I can get the icon to show, but it links back to my site instead of the feed link.
Here's what I have in my aggregator.module (4.5.2) Anyone have any ideas on how to fix this?
/**
* Format an individual feed item for display on the aggregator page.
*
* @ingroup themeable
*/
function theme_aggregator_page_item($item) {
static $last;
global $user;
$date = date('Ymd', $item->timestamp);
if ($date != $last) {
$last = $date;
$output .= '<h3>'. date('F j, Y', $item->timestamp) ."</h3>\n";
}
$output .= "<div class=\"news-item\">\n";
$output .= ' <span class="date">'. date('H:i', $item->timestamp) . '</span>';
$output .= " <div class=\"title\"><a href=\"$item->link\">$item->title</a> ";
$output .= " <a href=\"$feed_url\"><image src=\"images/rss_small.gif\"></a> ";
$output .= "</div><br>\n";
$output .= "<div class=\"body\">\n";
if ($item->description) {
$output .= " <div class=\"description\">$item->description</div>\n";
}
if ($item->ftitle && $item->fid) {
$output .= " <div class=\"description\"> </div>\n";
$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);
}
$output .= "</div>\n";
$output .= "</div>\n";
return $output;
}
Thanks,
Jeff
Comments
xml icon
I thought you needed to use the built in theme_xml_icon() for RSS icons?
I know it's late at night (here) but I cannot see where $feed_url is initialized before you use it as the feed link? Is that your first problem...?
--
www.gadgetspy.co.uk | www.bargainspy.co.uk
--
Ixis (UK): Drupal support, Drupal hosting.
I know it's late at night
I know it's late at night (here) but I cannot see where $feed_url is initialized before you use it as the feed link? Is that your first problem...?
Probably. I'm not sure about the right way to initialize it. My coding skills leave a LOT to be desired. :-)
Jeff
Bloggator.com
Get your blog on.