Blogroll update
I mentioned in a previous post that I've started using Bloglines for all sorts of cool stuff, from rss aggregation to powering my blogroll. One thing that I found that I don't like is, with over 20 or so feeds, the list was way too long. So, I hacked up some PHP to display just the 20 most recently updated sites in my roll. This caused severe delays when loading the site, so I decided to use cron to call wget with my php script, and output that to a static file. I've set cron to run this script every two hours, to keep traffic to Bloglines down. Oh, and I was polite and tagged it with "Powered by Bloglines" at the end, as it was originally, because that gets stripped by my script unless there are less than 20 sites in the roll.
[Update - 01/31/2006:] I suppose I should include the code that I use to get my blogroll. I hacked it from someone elses code that was designed for something else. This file is named getblogroll.php:
Next, in my template, I add
[Update - 01/31/2006:] I suppose I should include the code that I use to get my blogroll. I hacked it from someone elses code that was designed for something else. This file is named getblogroll.php:
<?
// Replace YOURID with your bloglines ID
$url="http://rpc.bloglines.com/blogroll?html=1&id=YOURID";
$count = 0;
$lines = 20;
if ($my_blogroll = @fopen("$url", "r")){
// for some reason, the first two iterations return blank lines, so add 2
while (! feof($my_blogroll) && $count < $lines+2) {
$blogroll = fgets($my_blogroll, 255);
echo $blogroll;
$count++;
}
echo "<a href='" . $url ."'><i>Powered by Bloglines</i></a>";
} else {
echo "ERROR: Blogroll is currently inaccessible";
}
?>
Next, in my template, I add
<? include("blogroll.php"); ?> where I want the blogroll to appear. Finally, I add wget -O/home/wintermute/public_html/blogroll.php http://www.nitemarecafe.com/getblogroll.php > /dev/null 2>&1 to my crontab, and set it to run every two hours.







