如何将多个Facebook Like按钮与计数器放在同一页面上

Dan*_*ric 17 facebook facebook-graph-api facebook-social-plugins

我有一个页面有多个新闻项目.列表中的每个项目都必须有自己的赞按钮.

是否可以在同一页面上为每个新闻添加多个Like按钮?

多个Facebook喜欢按钮,在同一页面上计数

Sha*_*ter 12

每个像按钮代码都必须拥有自己独特的URL.

参考:http://developers.facebook.com/docs/reference/plugins/like/

我使用php来实现这一点,通过从数据库中提取所需的所有相对URL,循环它们并在html5中将返回写入data-href参数,如按钮代码.

您可以像我一样手动设置这些链接或设置动态系统.


html5按钮代码.

<div class="fb-like" data-href="'.$thepage[link1].'" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="tahoma" style="margin-left: auto; margin-right: auto; text-align: center;"></div>

<div class="fb-like" data-href="'.$thepage[link2].'" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="tahoma" style="margin-left: auto; margin-right: auto; text-align: center;"></div>

<div class="fb-like" data-href="'.$thepage[link3].'" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="tahoma" style="margin-left: auto; margin-right: auto; text-align: center;"></div>
Run Code Online (Sandbox Code Playgroud)

xfbml按钮

<fb:like href="http://anotherfeed.com?link=1" send="true" width="450" show_faces="true"></fb:like>

<fb:like href="http://anotherfeed.com?link=2" send="true" width="450" show_faces="true"></fb:like>

<fb:like href="http://anotherfeed.com?link=3" send="true" width="450" show_faces="true"></fb:like>
Run Code Online (Sandbox Code Playgroud)

  • 它只是我,还是这使得Chromes内存使用量猛增? (5认同)