Hello,

On the main page of my web site I have a Panel Page with blocked containing Aggregator content. The HTML source of the block is as follows:

<h2 class="title">Title</h2>
<div class="content">
   <div class="item-list">
      <ul>
           <li><a href="http://www.site.com">Link</a></li>
           <li><a href="http://www.site.com">Link</a></li>
           <li><a href="http://www.site.com">Link</a></li>
      </ul>
   </div>
   <div class="more-link">
      <a href="/aggregator/sources/1" title="title">more</a>
   </div>
</div>

I would like to modify the HTML source to the following:

<h2 class="title">Title</h2>
<div class="content">
   <div class="item-list">
      <ul>
         <li><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
      </ul>
   </div>
   <a href="#" class="expand" id="exposure">More...</a>
   <div id="expand-exposure">
      <ul>
         <li><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
      </ul>
      <div class="more-link">
         <a href="/aggregator/sources/1" title="title">Even more...</a>
      </div>
   </div>
</div>

The reason for the change is that I would like to implement the following in Drupal:

DEMO: http://tinyurl.com/6pkxum
(Click the "More..." link to reveal more list items. The user then has the option to click on "Even more..." which would link to an /aggregator/sources page which would list even more list items...)

My question is how can I make this change to the aggregator HTML source? Those with a suitable solution or pointers should post for Drupal 5 and Drupal 6 to be the most help to others also interested in a solution.

Thank you kindly for assistance!

Comments

NToronto’s picture

I have found the Drupal-way to create a collapsible fieldset.

Note: Required misc/collapse.js

<?php
drupal_add_js('misc/collapse.js');
?>
<fieldset class=" collapsible collapsed">
  <legend>More Info</legend>
  <div class="fieldset-wrapper">
    <h3>Content goes here</h3>
    <p>
    Lots of hidden text.
    Lots of hidden text.
    Lots of hidden text.
    Lots of hidden text.
    Lots of hidden text.
    </p>
  </div>
</fieldset>

I still need to figure out how to modify the aggregator HTML source? Any ideas?

NToronto’s picture

anybody? Help much appreciated!

NToronto’s picture

?

dietcheese’s picture

I have the same problem. You ever figure it out?

Madis’s picture

It's been some years since the question was asked, but maybe my post will be of help for someone still. I wanted to change the aggregator block output for a RSS feed myself and I did not find any easy and good solution for it so I ended up creating a custom module with a custom block that displayed the information I needed in the way I needed (for Drupal 6). It might be possible to do this with the views module as well (there should be plenty of information, tutorials out there if you wanna try it).
Another option is to override 'theme_aggregator_block_item' and/or 'theme_item_list' in your theme template file, but you'll have to watch out that your changes don't break any other output that goes through these functions.
Anyway here's the code for the custom block I created in case anyone is interested (requires core aggregator module to be enabled):

function MyModuleName_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0] = array('info' => t('Custom RSS feed block')); // The block name.
    return $blocks;
  }
  
  else if ($op == 'view') {
    if ($delta == 0) {
      
      $id = 1; // Feed id (hover over one the feed links in 'admin/content/aggregator/list' and take the last number in the shown url).
      $no = 3; // How many items to pull out for the block display.
      
      if ($feed = db_fetch_object(db_query('SELECT fid, title FROM {aggregator_feed} WHERE fid = %d', $id))) {
        $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC', $feed->fid, 0, $no);
        $block['subject'] = check_plain($feed->title); // Default block title will be the feed title.
      }
      
      // Adding the individual items to the block with the needed html code.
      $counter = $no;
      while ($item = db_fetch_object($result)) {
        if ($counter == 1) $eclass = 'news-item-last'; else $eclass = '';
        $block['content'] .= '<div class="news-item ' . $eclass . '">';
        $block['content'] .= '<div class="date">' . format_date($item->timestamp, 'custom', 'd.m.Y') . '</div>';
        $block['content'] .= '<h3><a target="stuff" href="'. check_url($item->link) . '">'. check_plain($item->title) . "</a></h3>";
        $block['content'] .= '<div class="snip">' . $item->description . '</div>';
        $block['content'] .= '</div>';
        if ($counter == 1) {
          $block['content'] .= '<div class="all">' . l(t('Check all news'), 'http://www.google.com', array('attributes' => array('target' => 'stuff'))) . '</div>';
        }
        $counter--;
      }
      
      return $block;
    }
  }
}