Adding “Current Page” Facebook Like Buttons to Your Website

2 Feb, 2011 Posted by

The Facebook Like Button allows visitors on your website to quickly and seamlessly share your website’s content on their Facebook News Feed. If you would like to add the Facebook Like button to all of your website pages and have the URL and meta information picked up dynamically for that current page, you can implement XFBML (have fun!), or you can add a little PHP code into the standard Like button code.

If you’re using a CMS such as CMS Made Simple (CMSMS) or WordPress, it’s best to use a module/plug-in written for one of those platforms. Otherwise, here is an example of what you can do with PHP …


<iframe src="http://www.facebook.com/widgets/like.php?href=<?=urlencode("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>

Do you like this?

Tags / Related Content:

Comments

0 Comments

Leave A Reply