18/11/06

Permalink 10:10:27 pm, by robertc Email , 436 words, 618 views   English (UK)
Categories: Web Develop Share on reddit Share on digg Share on del.icio.us Share on ma.gnolia.com Share on StumbleUpon

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. :oops: 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:

Comment from: mike [Visitor] · http://mikeomatic.net
Hey Rob,

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
PermalinkPermalink 25/11/06 @ 03:26
Comment from: robertc [Member] Email · http://www.boogdesign.com/
Thanks Mike! No, I don't use Wordpress, but I've activated the link to give those guys a little extra Google juice for their hard work :) BTW, your blog is excellent, I read it regularly, keep it up!

Rob
PermalinkPermalink 25/11/06 @ 23:33

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

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

    Syndicate this blog XML

    • RSS 0.92 Posts RSS 0.92 Comments
    • RSS 1.0 Posts RSS 1.0 Comments
    • RSS 2.0 Posts RSS 2.0 Comments
    • Atom Posts Atom Comments
    What is RSS?

    License info

    Creative Commons License
    This work is licensed under a Creative Commons Attribution-Share Alike 2.5 License.

    powered by
    b2evolution

    get hCard