boogdesign posts
18/11/06
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.
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...
Trackback address for this post:
http://www.boogdesign.com/b2evo/th1srv/trackback.php/145
Comments, Trackbacks, Pingbacks:
For mine I used the sociable plugin for wordpress, available at this site:
http://push.cx/sociable
Doesn't look like you use wordpress, but I just wanted to give those guys credit for a job well done. :)
-Mike
Rob
Leave a comment:
Hot Topics
Popular
boogdesign posts
Longer posts on standards based web design, portable web development and Linux, intermingled with some stuff on my other nerd interests.
Search
Categories
- All
- General (13)
- Linux (42)
- Debian / Ubuntu (5)
- Fedora / Red Hat (17)
- Gentoo (5)
- SuSE (12)
- Semantic Web and Microformats (5)
- Web Design (21)
- Web Develop (40)
Archives
- June 2008 (5)
- May 2008 (3)
- April 2008 (3)
- March 2008 (3)
- November 2007 (2)
- October 2007 (3)
- August 2007 (1)
- July 2007 (2)
- June 2007 (8)
- May 2007 (3)
- April 2007 (2)
- March 2007 (4)
- More...








