如何创建一个Facebook喜欢柜台我的网站上的页面? [英] How to create a Facebook Like Counter for a page on my website?

查看:196
本文介绍了如何创建一个Facebook喜欢柜台我的网站上的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上为特定网页创建一个Facebook喜欢的计数器。

I want to create a Facebook like counter for specific pages on my website.

例如,我可能在我的网站上有这些网页,关于他们的不同文章:

For example I may have these pages on my website, of which, each have a different article on them:

www.mysite.com/article1.cfm

www.mysite.com/article2.cfm

www.mysite.com/article3.cfm

我想每个页面都有自己的Facebook喜欢计数器元素,当点击将跟踪个人页面有多少喜欢。我试图查看Facebook的所有这一切的解释,但我是新的Facebook发展。我必须使用的主要服务器端语言ColdFusion - 当然如果有一个JavaScript / jQuery解决方案或其他方法来完成这个我是开放的。

I want each of these pages to have its own Facebook "like" counter element which when clicked will keep track of how many likes that individual page has. I've tried to check out Facebook's explanation of all of this, but I'm new to Facebook development. My primary server-side language I must use to accomplish this is ColdFusion - of course if there is a JavaScript/jQuery solution or other ways to accomplish this I am open.

推荐答案

这是您如何将Facebook添加到您的网页中:

This is how you'd add facebook like to your pages:

<html xmlns:fb="http://ogp.me/ns/fb#">
    <head>
    </head>
    <body>
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=YOUR_APP_ID";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

        <div class="fb-like" data-href="http://www.yourwebsite.com" data-send="false" data-layout="box_count" data-width="450" data-show-faces="false"></div>
    </body>
</html>

其中:


  • YOUR_APP_ID:必须是您可以通过拥有Facebook开发人员帐户创建的应用程序ID。您可以这里创建一个。

  • http://www.yourwebsite.com :您网站的网址。因为
    facebook like实际上是发布到你的时间表,这将是
    到它的链接

  • YOUR_APP_ID: Must be an application ID you can create by having a facebook developer account. you can create one by going here
  • http://www.yourwebsite.com: Is the URL to your website. because facebook like actually posts to your timeline, this is going to be the link to it

这篇关于如何创建一个Facebook喜欢柜台我的网站上的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆