Adding a Facebook “Like” block to your Drupal site

I just added the newly announced “Like” button to my blog. It’s very easy to do on Drupal.

First, enable PHP input format…
In Drupal 6, the PHP input format is not enabled by default – it has to be enabled by enabling an additional module. So go to admin/build/modules and enable:
PHP filter 6.8 Allows embedded PHP code/snippets to be evaluated.

Next, create your new block…
Go to #Administer, #Site building, #Blocks
Click on the “add blocks” tab
Enter in a Block description and put the following in the Block body:

<iframe id="iframe_like" name="fbLikeIFrame_0" class="social-iframe" scrolling="no" frameborder="0" src=";show_faces=1&amp;layout=standard&amp;href=<?php $curr_url = check_plain("http://" .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']); echo $curr_url; ?>" width=100 height=300></iframe>

Change the “Input format” to “PHP Code”

Save it and you’re done!

[ad name=”webhosting”]


  1. Hello, Dear 🙂
    Please, help me.. I did everything, like You recommended, but i cannot see the Facebook like button, only the name of the Block and the same text which You suggested to put in the Block body 🙁
    Maybe You know how could i fix it?

  2. Thanks so much JerryJr!!! it works like a charm!!

    I have another facebook share module and I needed to fix the width to 60% to make them align.

Comments are closed.