A nice person who shares the same name as a famous hair dude contacted me asking how to the drupal news aggregator block show teasers rather than simple titles. This is for the non-profit "The Epilepsy Support Centre". He pointed to this post on my personal site where I reference themable function overrides in template.php.
Theme overrides are really very simple for those brave enough to grep through the module code and do some experimenting. note: this is for drupal v 5.x but the process is the same for any version using a phptemplate based theme.
In this case a simple 'find all' search in aggregator.module for the term 'theme' returns a pretty short list of items, you will notice toward the bottom a few references to "@ingroup themeable". This is the good stuff.
The original code from the module begins line 1317
/**
* Format an individual feed item for display in the block.
*
* @ingroup themeable
*/
function theme_aggregator_block_item($item, $feed = 0) {
global $user;
if ($user->uid && module_exists('blog') && user_access('edit own blog')) {
if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
$output .= '<div class="icon">'. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'</div>';
}
}
// Display the external link to the item.
$output .= '<a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a>\n";
return $output;
}
There's lots we can do away with here, like the 'blog it' links and the titles themselves since they were part of the aggregator teaser for the feed I chose already. (I used this google feed:
http://news.google.com/news?ie=UTF-8&oe=utf-8&rls=org.mozilla%3Aen-US%3Aofficial&client=firefox-a&um=1&tab=wn&q=news+epilepsy&output=rss) Since we know we want the block to mimic the teaser from the aggregator news page the next step is to find how that is generated. Scroll down to line 1355 and you'll see "Format an individual feed item for display on the aggregator page.", the function is "function theme_aggregator_page_item($item)" The part we want to steal is line 1377:
if ($item->description) {
$output .= '<div class="feed-item-body">'. aggregator_filter_xss($item->description) ."

