Skip to content

Instantly share code, notes, and snippets.

@divineslight
Created August 21, 2011 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divineslight/1160739 to your computer and use it in GitHub Desktop.
Save divineslight/1160739 to your computer and use it in GitHub Desktop.
Simple code for social bookmarking snippet in PHP for Google+1, Twitter and FB.

Google+1, Twitter & FB Social Bookmarking with PHP

Just include the code in your helper library and tweak CSS to your needs.

function lph_social_bookmarking( $url )
{
echo
'<div class="social_bookmarking">
<!-- Facebook Share -->
<div class="social_bookmark facebook">
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=112150088882944&amp;xfbml=1"></script>
<fb:like href="'.$url.'" send="false" layout="box_count" width="50" show_faces="false" colorscheme="light" font=""></fb:like>
</div>
<!-- Google +1 button -->
<div class="social_bookmark">
<g:plusone size="tall"></g:plusone>
</div>
<!-- Twitter share -->
<div class="social_bookmark twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
</div>';
}
div.social_bookmarking
{
float: right;
position: relative;
top: -65px;
}
div.social_bookmarking div.social_bookmark
{
float: left; width: 50px; margin-right: 10px;
}
div.social_bookmarking div.twitter
{
width: 55px;
}
div.social_bookmarking div.facebook
{
width: 47px;
}
@divineslight
Copy link
Author

Any idea why my code.php is not syntax highlighted? :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment