After searching around in vain this morning for a module to include the nifty Facebook Like widget on some client sites I came to the realization that it should work just like the Tweetmeme solution I cooked up back in December last year.
The idea is that Facebook gives you an iframe tag to use per domain - so instead of hard-coding a URL into the code to let people 'like' a specific page just make that URL call dynamic using the PHP so that the tag works on any node you want it on. From there all you have to do is embed the code in a node-type.tpl.php template file and boom you're off!
Here's the code with a wrapper div you can use via CSS for extra positioning etc: What you'll notice is that you don't have to do much - just get the code from facebook then include your own root URL and add the php to call specific nodes right after it :
<?php print $node_url ?>
You can see this in action here on the Why Drupal blog at the end of each post.
Related Post(s)
-
Thursday Dec 22, '11
-
Wednesday Dec 14, '11
-
Thursday Sep 15, '11
Recently blogged
Recent comments
-
Every New Year bringsSaturday Jan 28
-
A new product if is goodFriday Jan 6
-
Great post however I wasSunday Dec 25
-
a new indexhibit is coming!Wednesday Nov 30
-
I love this site you made. SoWednesday Sep 14
Our Podcast
Subscribe to our podcasts through the iTunes store for free!
Subscribe
Sign up to our email newsletter to stay in touch - we send it out monthly and never spam.
Archives
- October 2007 (5)
- November 2007 (6)
- December 2007 (1)
- January 2008 (1)
- February 2008 (1)
- March 2008 (2)
- April 2008 (6)
- May 2008 (1)
- June 2008 (1)
- July 2008 (2)
- August 2008 (1)
- September 2008 (5)
- October 2008 (3)
- November 2008 (1)
- January 2009 (3)
- February 2009 (1)
- March 2009 (4)
- April 2009 (2)
- May 2009 (1)
- November 2009 (3)
- December 2009 (2)
- January 2010 (13)
- February 2010 (5)
- March 2010 (9)
- April 2010 (2)
- June 2010 (9)
- July 2010 (6)
- August 2010 (3)
- September 2010 (4)
- October 2010 (1)
- November 2010 (2)
- January 2011 (2)
- February 2011 (3)
- March 2011 (3)
- April 2011 (3)
- May 2011 (3)
- June 2011 (2)
- July 2011 (1)
- August 2011 (3)
- September 2011 (2)
- October 2011 (1)
- November 2011 (2)
- December 2011 (3)
- January 2012 (1)
