ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How Do I Add A Facebook "Like" Button?

March 11, 2011 11:32am

Subscribe [4]
  • #1 / Mar 11, 2011 11:32am

    jretzer

    57 posts

    I’d like to add a Facebook like button to each page of my site. But the Facebook code requires an individual url.

    <iframe src="http://www.facebook.com/plugins/like.php?href=http://{title_permalink={template_group_name}/comments}&layout=standard&show_faces=true&width=450&action=like&font&colorscheme;=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

    There’s got to be a way to insert a variable in there, but inserting my permalink code doesn’t seem to do it

    <iframe src="http://www.facebook.com/plugins/like.php?href=http://{title_permalink={template_group_name}/comments}&layout=standard&show_faces=true&width=450&action=like&font&colorscheme;=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

    What am I doing wrong?

  • #2 / Mar 11, 2011 11:56am

    Paul Stone

    97 posts

    I just used their FBML version of the like button.  It does it all for you…

    < script src="http://connect.facebook.net/en_US/all.js#xfbml=1">< /script><fb:like layout="button_count" width="100"></fb:like>

    Edit: you’ll need to remove those spaces in the script tags - the EE forum stripped them out.

  • #3 / Mar 11, 2011 2:04pm

    jretzer

    57 posts

    Thanks. That works. I’d tried it before and it didn’t work ... but now it does ...

    BTW, I also discovered how to control the image facebook uses to designate the link:

    <meta property="og:image" content="path_to_image"/>
  • #4 / Mar 11, 2011 5:03pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Paul.

    jretzer - Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases