Little buttons of sharing

I've long been jealous of all the little buttons everyone else seems to have on their blogs (have a look at the section 'like this article, share it' on mike-o-matic), to let their readers add the posts to digg or reddit or whatever other social link sharing network they might be a fan of. They didn't look that difficult to achieve, so I figured it was really just a case of sitting down and sorting it out. Just get it done. Anytime would be good really.

Well, a few months later, I surprised myself by actually doing it!

I started off by trying to add one of the reddit buttons. I didn't really like the look of it, though - it takes up a fixed amount of space whether the article's on reddit or not, and it embeds an iframe which spoiled my cunning semi-transparent background effect, as well as making the whole page scroll even more slowly in Firefox (in general, it seems, fixed positioning and iframes don't mix well - rendering the blog home page maxes out both cores on my PC, someday soon I'll get around to another re-design...). So I fell back on bog standard images inside links - it's not like I'm really expecting to have any need to track the high scores of each of my blog posts anyway.

There was only one tricky bit, working out how to generate the URL from b2evo. I could have just read the documentation, but that wouldn't have been any fun, so instead I dug around in the source code until I found the get_permanent_url method of the Item class. The final code I added for my two buttons was:

<a href="http://reddit.com/submit?url=<?php echo $Item->get_permanent_url(); ?>"><img src="/images/reddit.png" alt="Share on reddit"/></a>
<a href="http://del.icio.us/post?url=<?php echo $Item->get_permanent_url(); ?>"><img src="/images/delicious.png" alt="Share on del.icio.us"/></a>

Of course, then I thought "I'll just check and see if the page still validates as XHTML Strict" and discovered a whole host of issues which have been stopping the page validating for a good while. &#58;&#111;&#111;&#112;&#115;&#58; Mostly with the Clustrmap, but also a strange issue b2evo seems to have with sticking <br>s in the middle of lists. The fix seems to be to take all the newlines out from between the <li> tags - that may take me some time...