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
Configuration
This isn’t a regular WordPress plugin and you can’t access the setting through your Dashboard, but I’ll help you out.
- Unzip and open “technorati.php”
- 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.
- 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).
Ah thanks for the tip! The only thing I need help with is to manually install the related post plugin.. I saw your technorati ranking at the top right now!
How can I help with the Related Posts plugin?
Hi Saman, thanks for your offer.
I found another plugin that worked – similar post plugin.
Ah…anything to allow you to brag even more about your super Technorati Take-Off!!
That’s a nice plugin. I use Joomla but I’m sure something similar could be configured for that. If I had a site with a rank under 50,000 and I actually wanted to share it, that is.
Nice job! That’s fantastic (and quick!) I’ll put a link from my site over to here.
Thanks Doug!!
Wow that is a really nice little script. I’m looking over the code now and adding it to my site!
Ok I finally got it working properly. I had to add some checks to make sure a) the file existed : if(!file_exists($cache_file)) echo “File does not exist!”);
And I also had to put in a check for seeing whether or not it was writable: if(!is_writable($cache_file)) echo “File is not writable”;
But then I fixed my permissions and everything is working great! I change the look of it a little bit but I do like it. It writes properly to the cache file and reads from it when needed!
Good find!
I’m glad you’re fancy enough to have got it working!
good plugin ..!!
Hi Saman,
Greeting from Miami Beach, FL. I will definitely add this plugin once I get home. Since you’re using 1&1 so we are basically at the same boat. Need to thank your PHP God friend Bobby too.
With 1&1, I just found out that they some how run PHP 3,4 and 5. You can specify what the script runs by changing the file’s extension to .php5!
23 thousand and counting!
I keep getting this error message when I update the file sidebar.php:
Parse error: parse error, unexpected ‘:’ in /path to/my/folder/sidebar.php on line 12
Line 12 is the line where I placed the php code.
Any idea what’s wrong, Saman?
Thanks.
Hey drt,
There is not really enough info posted here to really help. That error is just telling you that there is some incorrect formatting in your code.
You might be inserting that in the middle of something else that is going on.
I might be able to help if you posted some of the code on here. Post about 20 lines of code pointing out where it is that you are trying to insert the code…..
Thanks, Bob. I was trying to insert the codes in the space markedb by lines below in sidebar.php:
—- quote —–
[---insert-------->
I insert the codes in the Installation part above after removing the space between ]
Categories
—- end quote from sidebar.php —
If I go back to try, it will take my site down with the same error message.
Saman, if you don’t mind we can keep the discussion here to document the problem other users may encounter. But I can get off line with Bob, in case this will become too boring for some of the readers.
Again thank you guys.
Thanks to Saman and Bobby. With Bobby’s suggestion I switched to local file and it gave me some more lines of error which provided more options to try. Finally I got back to url addressing but simply added the back slash at the end of my url and voila, it was there. The error were gone. Thus, if you found the same error like mine, go back and add “/” at the end of your url in technorati.php . Good luck!
I’m very glad you got this working. Maybe if I ever have the time to work on it, I will try to make it more WordPress friendly and actually set it up to be a php4+ plugin. I know a lot of people are using it since it does not require curl as well. The plugin interface would probably make it a whole lot easier to use.
If any of you come to this page, and you would prefer it to be redesigned into a plugin – reply to this post. I want to see if there is a good demand for it out there, or if people are just more than happy using Doug Karr’s plugin.
So tell you what – 15 or more replies to this post in favor of it from different people – than I will make it happen.
Also, if you have any, please make any suggestions as to what you would like to see in it – if you would like to see anything different.
Bobs, you are a great guy – do you see this people? He is willing to help anyone out!!
It’s like I’ve said before, everyone should have a friend like Bobs!
Bob,
Any chance you can tweak plugin to display number of links away from a Technorati ranking? Like “53 links away from Technorati 1000″.
Hey Saman, would you (or your friend) mind if I took this and turned it into a true wordpress plug-in?
I’m okay with it so long as you somehow co-credit myself and Saman (like based off of) including our URLs in your description. Also, it would only be right to credit Doug as the original creator of a similar plugin as I did.
But yes please, so long as you do that, go right ahead!
a suggestion:
be sure to throw in something that checks to make sure the site is available before anything is processed. I know Tyler Ingram ran into a problem when his DNS was having issues – the script would hang. So be sure to throw something in like “checkdnsrr()” to make sure it will pull the data in when it tries.
Please comment back and let us know if you decide to take on this project. It is something I currently have on my “to-do”, so just want to know if I should take it off or not.
Credit will be given to all 3 of you of course. I’m merely packaging it into a nice little wordpress interface. I’ll start work on it on Tuesday when I have free time
Cool – can’t wait to see it! One less thing on my “to-do” which is a big help. Please let me know if I can be any help during the process if you have any php4 questions or anything.
I think that should be the biggest goal of this one, make sure it is backward compatible with php4 so that it is competition still for Doug’s. No php5+ only functions.
It would be cool to be able to include all of the variables right from the Plugin’s page of the dashboard!
Thank you for this lovely piece of code! i am still with php4 and appreciate your work.
ooh wow!
My server have PHP5 but not the simpleXML plugin installed so I tried to use this script and….. wow my rank is displayed (in my admin page).
Thank a lot
Doug Karr has some good plugins. I also like his PostPost plugin.
thank you so very much
Does the code work in a widget? Just curious, because I added it to a widget and I got a blank spot where it should be…
Otherwise an excellent plugin for those that don’t have either PHP 5 or where hosts haven’t enabled either cURL or SimpleXML. Definately worth a post and trackback!
Sorry, we didn’t create this to be a widget – it was a quick-and-dirty hack…
Thanks anyways for the great plug-in. I’ll be sure to post here often.