« Home | ClipBlog » | Save time with multiple printer configurations » | The Art of Bootstrapping » | Site problems » | State of WLAN Support on Linux? » | Bloglines & FeedBurner » | Blogging & RSS » | Six Reasons To Hate Talkswitch Phone Systems » | Wireless flaw in windows » | Friday 13 » 


Monday, January 30, 2006 

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:

<?
// 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.

Technorati tags: ,

Towel Day

About me


  • Name: Wintermute
  • Location: Lancaster, Ohio, United States
  • I've been a computer geek since about 1983, and I plan on sharing some of the things that are interesting to this particular computer geek.
My profile

Currently Reading

Listen To

Blogroll


    Warning: readfile(/home/wintermute/public_html/blogroll.php) [function.readfile]: failed to open stream: No such file or directory in /home/content/n/i/c/nicofthyme/html/nitemarecafe/2006/01/blogroll-update.php on line 406

Search


Contact

Powered by Blogger
and Blogger Templates


Ohio LinuxFest 2006