adding a facebook ‘like’ button to your page

I’ve been having a little play with facebook features recently, and I’ve now added the facebook ‘Like’ button feature to The feature is the little icon with the thumb, which users can click to “like” your web page. It is updated real-time and displays on their wall also.


At any given time, a visitor to your page can see how many people have liked your pae, and can then like it themselves. The coding for this is extremely simple, and I’m posting a general format of it here for your dining pleasure.

<iframe src="

<?php echo currPageName(); ?>&amp;layout=standard&amp;show_faces=false&amp;


scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px;

height:35px;" allowTransparency="true"></iframe>


The PHP function I have called ( currPageName(); ) is below:


function currPageName() {

return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);



This is all done within an iframe, and is made super simple due to facebook’s developer resources.

Now, a visitor to your site, as long as they are logged into facebook , will be able to give your page a “Thumbs up” by simply clicking this Like button. They can also comment about it as this is posted to their wall.

For more specific detail of the settings and format of the request, check out the documentation.


About Cameron
I'm a final year Computer Science/Information Systems major. Already finished my BA in Politics/Philosophy. I do web and software freelance on the side, while I finish studying. Hoping to be self-employed by the end of my degree, otherwise off into the real-world I go....

One Response to adding a facebook ‘like’ button to your page

  1. Pingback: Tweets that mention adding a facebook ‘like’ button to your page « whileloop --

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: