Websites for sale:
Used Cars for Sale - $175 and Car Sale.
If interested drop me a line at ken@kensfi.com. Thanks!

Have questions about Toronto? Check my latest project: Ask about Toronto!

Add Share & Bookmark this button to a non-blog website

First of all this solution is addressing to everyone looking to add Share This button to a normal website NOT a WordPress blog or for blogger! Since there are yet hundreds of solutions for blogs it was very hard to find one to apply to a normal website.

The solution is coming from Share this website and it works like a charm on my new Toronto Questions and Answers community website.

All you have to do is to create an account on this website and follow the steps to get the code which you’ll have to implement into your code. The tricky part for me was implementing this code into a PHP dynamic page but after all I did it. What I really like is that this code is sending the title as well to twitter.

How is looking my code:
Header:

$themeclass->output('<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=528c6e14-4662-46fd-a2d0-7bc17b963240&amp;type=website&amp;post_services=email%2Cfacebook%2Ctwitter%2Cgbuzz%2Cmyspace%2Cdigg%2Csms%2Cwindows_live%2Cdelicious%2Cstumbleupon%2Creddit%2Cgoogle_bmarks%2Clinkedin%2Cbebo%2Cybuzz%2Cblogger%2Cyahoo_bmarks%2Cmixx%2Ctechnorati%2Cfriendfeed%2Cpropeller%2Cwordpress%2Cnewsvine&amp;button=false"></script>');

Body code (where I wanted the Share this button to appear on the page):

function q_view_buttons($q_view)
    { if (!empty($q_view['form']))
        {
        $this->output('<DIV CLASS="qa-q-view-buttons">');
        $this->output('<a id="ck_email" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/email.gif" /></a>
    <a id="ck_facebook" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/facebook.gif" /></a>
    <a id="ck_twitter" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/twitter.gif" /></a>
    <a id="ck_sharethis" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/sharethis.gif" /></a>
   
    <script type="text/javascript">
        var shared_object = SHARETHIS.addEntry({
        title: document.title,
        url: document.location.href
        });

    shared_object.attachButton(document.getElementById("ck_sharethis"));
    shared_object.attachChicklet("email", document.getElementById("ck_email"));
    shared_object.attachChicklet("facebook", document.getElementById("ck_facebook"));
    shared_object.attachChicklet("twitter", document.getElementById("ck_twitter"));
    </script>');
    $this->output('</DIV>');
        }
}

Before Share this I’d tried Tweet meme but with no success. Since Share this is the only one which was entirely working I thought will help other like me trying to implement Tweet me or Share on Facebook sharing buttons on their non-blog websites.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related Posts

Php

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Please read before commenting:

I don't tolerate spam comments. Be human and polite. If you are signing as "Computer repairing", "iPhone store" or other kind of bullshits you'll be marked as spam.
USE YOUR NAME! Thanks!

Comments

One Response to “Add Share & Bookmark this button to a non-blog website”

Leave Comment

(required)

(required)