Doug Karr has written a plugin that can display your Technorati rank on your site, it’s a awesome idea – the problem for me was that my host runs PHP4 and Doug’s plugin needs PHP5 to run!

My good friend Bobby Matthis took it upon himself to edit the plugin so it could run on PHP4 – he is a PHP God, and he’s always ready to help me whenever he can. Everyone needs a friend like Bobs!

Hey Saman,
It was my pleasure. Feel free to disburse it out to anybody you know of that may still be hosting on php4. The code I’m sure could be cleaned up and such, but I didn’t want to spend too much time on it as I feel this project really is Doug Karr’s. It was his original idea and plugin, so nobody should take from that. Feel free to forward this Doug’s way. With a simple “php version” check in his plugin, he could now fully support both. That would make me more than happy, just to have his plugin be compatible with both versions.

Bobby

By the way, Bobby’s site is a little bare because he is so busy working on so many other projects! It’s just like a landscaper – a great landscaper has the worst yard in the neighborhood, they are just to busy!

Download

Technotari_PHP4.zip

Configuration

This isn’t a regular WordPress plugin and you can’t access the setting through your Dashboard, but I’ll help you out.

  1. Unzip and open “technorati.php”
  2. There a couple variables to edit:
    • technorati_key – This is your Technorati API Key.
    • technorati_url – The URL of the site you submitted to Technorati.
    • cache_time – How often the code rechecks your rank – you are only allows 500 requests a day and there really is no reason to have it ping more often then every hour because Technorati wont update it’s database more often then that.
    • cache_file – The code actually writes to this file, then we can call this cached file as often as we want! There isn’t really a reason to change this.
    • imgs_directory – The absolute path to the images – not a site relative path. You can put the images anywhere, just note it here.
  3. Upload the PHP file and images folder to your site. It doesn’t matter where you upload it to, but since all of your plugins are in the Plugins folder, that seems like a good place!

Installation

If you want to display the code in your sidebar, add this to your theme’s sidebar.php file:
< ?php
include ('http://path/to/the/file/technorati.php');
?>

I placed a space between the < and ?, you need to place these two together for the code to work and make sure you put the correct path in the code!

How It Works

Since we can only ping Technorati 500 times a day, the PHP code queries Technorati once every hour (or whatever you specify in the cache_time variable) and caches the result into the file you specify in the cache_file variable.

Why don’t we just call the ping result directly? If you get 100 page views a day, and each visitor views five pages, you have reached your limit!

This way, we save the cache into a file that no one ever sees, and call that file as often as we want!

Troubleshooting

Since the code is cached, any changes you make will not be shown until the next update time – this includes changes to any of the variables we set! If you do need to view the changes now, you need to FTP in to the location where you uploaded the PHP file and delete the cached file: defulat is technorati_ranking_cache.html (this is the result of the variable cache_file).