A twitter link back addition
Last modified: December 12, 2007 - 22:17
I took this apart as an exercise in grabbing stuff from the db and added the link information. Really basic, but it's my first shot at something like this:
<?php
// Adapted from http://drupal.org/node/151185
$fid = 1; // My feed id
$limit = 5; // Number of tweets in the list
$result = db_query('SELECT link, description, timestamp FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC LIMIT 0,' .$limit, $fid);
while($row = db_fetch_object($result)) {
print '<p class="my-twitter-status"><a href="'.($row->link).'">'.substr($row->description, 5).'</a> <span class="my-twitter-status-time">'.twitter_ago($row->timestamp).'</span></p>';
}
function twitter_ago($timestamp){
$difference = time() - $timestamp;
$text = format_interval($difference, 2) . " ago";
return $text;
}
?>