Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogDoes anyone have any code for Facebook Like?Does anyone have any code for Facebook Like?
Previous
 
Next
New Post
8/10/2010 10:38 AM
 
I am hoping someone has done this already.  I would like to create a blog template that has a Facebook Like button in it so everytime a blog is published through online method, or using WLW it will allow the user to share the link to the blog posting.
WLW used to have a plugin that worked but it is no longer supported.

Thanks.
 
New Post
8/15/2010 12:16 AM
 
I don't know of a module that does this for you automatically, but Facebook has some very limited documentation on how to add the Like Button.  The great thing about that page though, is that it has a form that will generate an iFrame for you. I am going to walk you through adding this Like Button to your blog.

Copy the iFrame code you want to use, and make sure that you paste it into a text editor so that you can add a little something to it.  

Add the following attribute to your iFrame code:  id="ifFacebook"

Remove the href key/value pair from the querystring in the source attribute of your iFrame tag, and add this to the end of the remaining URL:  &href=

Finally, place this jQuery snippet below your facebook code:
<script language="javascript" type="text/javascript">
 jQuery(document).ready(function(){ jQuery('#ifFacebook').attr('src', jQuery('#ifFacebook').attr('src') + location.href); });
</script>

The final step is to add this to your site.  There are a variety of ways to do this.  Using a method like PageBlaster would be the closest thing to a "best practice," and you could use the Footer setting in the Module Settings.  However, I added this code to the ViewEntry.ascx user control of the blog module, and replaced it on my site.  For my purposes, I simply added the resulting code just above the comments and chicklet section in the control.

Here's the example code I ended up with:

<iframe id="ifFacebook" src="http://www.facebook.com/plugins/like.php?show_faces=true&width=450&action=like&colorscheme=light&height=80&href=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function(){ jQuery('#ifFacebook').attr('src', jQuery('#ifFacebook').attr('src') + location.href); });
</script>

You can see an example of it on any of my blog posts, like this one.

Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
8/15/2010 2:05 AM
 
FYI...  I just posted a blog that has greater detail on this too:

http://www.dotnetnuke.com/Community/B...

Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
8/15/2010 8:13 AM
 
Will.  Uhm "WOW".   You have gone above and beyond on this one.   I am very much appreciative of your efforts.  Did you add this to the wiki yet?
PS:  I see you used to blog about photography.  Are you still taking photos?
 
New Post
8/15/2010 2:28 PM
 
I didn't add this to the wiki yet.  I am conflicted as to whether I should or not, since it's not really "documentation" but rather a workaround.  If you think it should be there, the wiki is the only place where I don't mind my content being copied to by others.

Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogDoes anyone have any code for Facebook Like?Does anyone have any code for Facebook Like?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out