PHP blo.gs blogroll, version 0.5.4
Snappy title, no?
What it is:
A PHP file which you include in your PHP weblog page, which will produce a dropdown/select menu in javascript-enabled browsers, or a list of links in non-javascript browsers (as seen on philringnalda.com). In either case, the list is sorted in descending order of update, based on when the weblog last pinged weblogs.com or another of blo.gs's sources of update info.
How to use it:
- Be sure your server supports PHP, and that your blog is being parsed as PHP (usually, that would mean the blog file is named something.php).
- Download phpblogroll.zip. Then you can stop reading here, since it's all in the poorly-formatted readme.txt too.
- Sign up at blo.gs and then add your favorites to your favorites list (you'll be happier if you use a decent browser, since Opera/Mozilla will show a cute little plus in a circle for things you haven't added, and an x in a circle for things you've already added, while IE will show a square box if it's added and "&oplus" if it isn't. If you must use IE, drag this fix blo.gs bookmarklet to your links bar, and then use it to make your own + and X).
- Once you've added your favorites to your list, click "settings" and check the box to make your list of favorites public. Save your settings, go back to the home page, and click "share". Down at the bottom of the page is a list of links to favorites in three flavors. Right click the "favorites.xml" and select "save target as" to save a copy of favorites.xml on your computer (you only have to save and upload it once, to prime the pump - after that it's automatic). While you are there, make a note of the number in the url, which is your user number - you'll need it when you edit blogroll.php.
- Open blogroll.php in your favorite text editor (and I do mean text, not a word processor), and prepare to edit.
- If for some reason you already have another file named favorites.xml on your server, you can change $xml_file to another name (and be sure to upload the starter file under another name). If you make your life difficult by having your actual archive PHP files in a separate archive directory (not just the include files that you include in a single index.php), then you'll need a path for favorites.xml that will work in both the main directory and your archive directory. Don't try to just use the full HTTP path including your domain - filemtime(), the function that checks for how old the file is, won't work if you use an HTTP path. Instead, you'll need to find the server path for the directory where favorites.xml will live. To find the path, create a file named dir.php which contains:
<html><body><? echo getcwd(); ?></body></html>
Upload it to your target directory, and view it in your browser. Add that path to favorites.xml in $xml_file.
- In $xml_source, be sure to change the 34 (which is my favorites) to your user number.
- Change $xml_test to some string of characters that will always be in your list of favorites. The best bet is something like 'evhead', which is very likely to remain in both the title and the url of a weblog that will (probably) always be in your favorites. Case doesn't matter: Evhead or evhead will work the same.
- If you feel the need to muck around with the stuff that comes before and after the weblog links, and you're brave enough, scroll down to $html_header and $html_footer and do what you must.
- Upload blogroll.php and favorites.xml to your server, and chmod favorites.xml: what you need to chmod it to depends on your server, but you need it to be something that blogroll.php can overwrite. When in doubt, use 666 (read and write for user group and other). After all, blogroll.php will be overwriting it with its own permissions in another hour.
- Add the javascript section from script.txt to the head section of your weblog template or to index.php if you are wisely using includes.
- In the spot where you want your blogroll, add:
<? include('blogroll.php'); ?>
(Here again, if you have to deal with archive files in another directory, use the full server path.)
- Publish if you changed your template, or upload if you changed a file that includes, and see if it works. If it does, turn off javascript, and see if it still works. Turn javascript back on, pick someone who shows their referrers (say, I do, and of course you put me on your favorites list), and make sure that the funky javascript to set the referrer is working.
- Enjoy: I highly recommend the three-fingered browse: with one finger on Alt, one on the left-arrow and one on the down-arrow, you can go to a blog, scroll down to read new posts, hit Alt-left-arrow to go back to your blog, down-arrow to the next blog, down-arrow to scroll, ...
A note on dealing with weblogs that don't ping: the first step is evangelism. Try to convince them that they are evil incarnate for not pinging weblogs.com. If they aren't using a tool that pings automatically, they can get a bookmarklet from my weblogs.com ping bookmarklet generator to ping manually. If all else fails, ping them yourself (either by creating a bookmarklet and pinging every time you notice an update, as a public service, or just once at the ping form just to get them listed in the system). They will sink down to the bottom of your list, but then, that's where they deserve to be, the anti-social ingrates.
35 comments
changelog