How can I display images and teaser text in the aggregator-summary bloc. By default only title appear?

Comments

info@zrix.com’s picture

Please call the following function in your template.php file. Under theme, write the name of your theme:


function 
theme_aggregator_summary_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";
$output .=  $item->description."\n";
  return $output;
}
info@zrix.com’s picture

Status: Active » Closed (fixed)
jweedman’s picture

Status: Closed (fixed) » Active

I've been looking at looking for someone to help me take care of this issue. Problem is... I can't get your php code to work.

I added the code to my template.php, under my theme (tief), and renamed the function to "tief_aggregator_summary_block_item($item, $feed = 0)", but it's still not working.

If it matters, I'm not printing out the summary block - I'm printing out a category block. The category block contains items from two separate rss feeds. Does this php code need some customization if you're printing out a category block and not a summary block? Thanks...

jweedman’s picture

Status: Active » Closed (fixed)

Nevermind!

Here's what I did. Instead of:
function theme_aggregator_summary_block_item($item, $feed = 0) { ...

I used:
function theme_aggregator_block_item($item, $feed = 0) {...

Then be sure to clear your site's main cache! It will not appear to be working if you don't clear your cache. You can do that by putting the following php code in any page, and navigating to that page in your browser to run the script:

echo "This page runs a script that clears the main cache.<br>";
db_query("DELETE FROM {cache} WHERE 1");
db_query("DELETE FROM {cache_filter} WHERE 1");
db_query("DELETE FROM {cache_menu} WHERE 1");
db_query("DELETE FROM {cache_page} WHERE 1");
echo "It's clear now.<br>";

NOTE: The only consequence in removing "summary" from the function name, is that now I suppose any block that Aggregator outputs will now contain the entire description, rather than the default of only printing out the title. For what I'm doing - not a big deal. If that would be a problem for you (ie - you're using Aggregator to print out other blocks that you just want the title printed), than you might be careful with what you put into template.php. "cmswebsiteservices" seems intelligent enough to answer any further questions you may have on that :)

Thanks...