I had it on my site with drupal 5 though it was hard coded making direct sql queries... And it was contrib module-dependent (can't remember which one) so this time I was thinking of either making one aggregator (/core module) dependent or make the module myself (since I found lots of people requesting one). I just need input onto how to get a grip on the whole thing. The nice thing would be, fetch the defined feeds, parse the latest items' titles and URLs and save them in the db (this could be done by cron every hour or so). Finally get the data and laying it nicely into the block:

BlogRoll

Feed 1:
"This is the feed1 title"

Feed 2:
"This is the feed2 title"

Feed 3:
"This is the feed3 title"

(and so on).

I thought of Views and Aggregator (and evl. CCK) to do it. What do you think?

Comments

filiptc’s picture

Here is a php snippet I managed to put together. It makes use of simplepie's feed reader 'simplepie.inc'. No contrib modules required (not even aggregator).
This snipped is very rough, I'm just posting it to save work and help out who might be lost, I know the code is far from perfect. You need to create a new table in your database (I called it 'blogroll') and, inside it, 4 rows: feed_title [varchar(255)], last_item [varchar(255)], item_url [varchar(255)], and timestamp [int(11)]. Then create a folder somewhere in your root and put the following blogroll.php and simplepie.inc in it. Optionally you can create a 'cache' subfolder and update the code to point to it. All you need to do now is add your feeds to blogroll.php.

blogroll.php

include('path/to/simplepie.inc');

// Connecting, selecting database
$link = mysql_connect('server', 'user', 'pass')
    or die('Could not connect: ' . mysql_error());
mysql_select_db('database') or die('Could not select database');

// feeds
$feeds_blogroll = array('URL_feed1',
				'URL_feed2',
				'URL_feed3',
				'URL_feed4',
				'...');

foreach ($feeds_blogroll as $feed_url) {
	$feed = new SimplePie();
	$feed->set_feed_url($feed_url);
	$feed->enable_order_by_date(false);
	$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . 'path/to/cache');
	$feed->init();
	$item = $feed->get_item(0);
	
	$feed_title = $feed->get_title();
	$item_title = $item->get_title();
	$item_url = $item->get_link();
	
	unset($query_check);
	$query_check = mysql_query("SELECT `feed_title` , `last_item` FROM `blogroll` WHERE `last_item` LIKE '".$item_title."'") or die(mysql_error());
    if(!mysql_num_rows($query_check) > 0){
		// Performing SQL queries
		mysql_query("DELETE FROM blogroll WHERE feed_title='$feed_title'") or die(mysql_error());
		mysql_query("INSERT INTO blogroll (feed_title, last_item, item_url, timestamp) VALUES('".$feed_title."', '".$item_title."', '".$item_url."', ".time().") ") or die(mysql_error());  
      }
}

Finally you need to create a block in which you write

include('/path/to/blogroll.php');

$result = mysql_query("SELECT * FROM blogroll") or die(mysql_error());

while($row = mysql_fetch_array($result))
  {
  echo "<b>" . $row['feed_title'] . "</b><br />";
  echo "<a href=".$row['item_url'].">" . $row['last_item'] . "</a><br />";
  echo "<small>&Uacute;ltima actualizaci&oacute;n: ".date('H:i:s', $row['timestamp'])."</small><br /><br />";
  }

(don't forget to enable php formatting). That's should make the feeds appear inside the block.

filiptc’s picture

Hard coding was kind of sloppy and took away the possibility of quick and fast changing of feeds and displaying options so I ended up entering the wild drupal module-developer world (which in the end isn't wild at all). Check out the module:

http://drupal.org/project/simpleblogroll