With the new layout of my site, I wanted something other than the traditional mile long blogroll column in a sidebar. More specifically, I wanted to break my blogroll into columns. With a little code from blogrolling.com;, I was able to whip up a PHP script in no-time to do just that.
All you need is a PHP enabled weblog, and a blogroll. Once you have your blogroll URL (the PHP URL provided for you by blogrolling), paste it into the value of $url. Next, adjust the $column_size (number of links in a column) and $column_width. Then surround the code with table and tr tags, and you're done!
<?php
// replace the value of $url with your own link
// from the code generator
$url = "paste your blogroll url here";
$count = 0;
//adjust column_size and column_width
$column_size = 20;
$column_width = 175;
echo "<td width=\"$column_width\">";
if ($my_blogroll = @fopen("$url", "r")) {
while (! feof($my_blogroll)) {
$blogroll = fgets($my_blogroll, 255);
echo "$blogroll";
$count++;
if($count >= $column_size) {
echo "</td>";
echo <td width=\"$column_width\" valign=\"top\">";
$count = 0;
}
}
} else {
echo "<td>";
echo "ERROR: Blogroll is currently inaccessible";
echo "</td>";
}
echo "</td>";
?>
The way the code is configured now, it will create columns with 20 links in them that are 175 pixels wide. You can see my columnized blogroll here;. If you have any problems, leave a comment and I'll try to help you out!