Adding Facebook Like to MediaWiki

I’m a pretty social girl. Whenever I see something new in social media that I think will have a big impact, I jump on the bandwagon as soon as I can. This past week Facebook released this new “like” button for people to use on their websites. It allows people to like pages that are not part of Facebook, and posts links to the Facebook news feed. Pretty sweet.

Facebook Like for MediaWiki
I like it!

I added it to The Pet Wiki as soon as I could. There are two versions – the FBML version and the iframe version. I went with the iframe version because I don’t have the JavaScript SDK running on my site. The iframe version works really well and has all the fuctionality of the FBML version. To add it, include this code in you skin:

<iframe src="<?php echo
urlencode($skin->mTitle->getFullURL()); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like
&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;
width:450px; height:20px"></iframe>

This version does not show the little pictures of people who like the page. If you want it to show the pictures, set show_faces=true. I also modified it to be a lot smaller than the original widget. You can play with the height and width to suit your site. I have like in my header – I stuck it right in the <h1> tag in the skin. I like seeing it at the top. Some people are trying to convince me to put it at the bottom of the page, so that I can include the faces as well. I still have to think about it. What do you think?