如何将多个Facebook Like按钮与计数器放在同一页面上 [英] How to put multiple Facebook Like buttons with counter on same page

查看:174
本文介绍了如何将多个Facebook Like按钮与计数器放在同一页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一页有多个新闻项目。列表中的每个项目都必须拥有自己的


我使用php来实现这一点,通过从
数据库中拉取所有相对urls,循环并写入数据 - href参数
html5像按钮代码


您可以手动设置这些链接或设置一个动态系统,因为我没有。






html5按钮代码

 <$ data-=falsedata-layout =button_countdata-width =90 data-show-faces =falsedata-font =tahomastyle =margin-left:auto; margin-right:auto; text-align:center;>< / div> 

< div class =fb-likedata-href ='。$ thepage [link2]。'data-send =falsedata-layout =button_countdata-width =90data-show-faces =falsedata-font =tahomastyle =margin-left:auto; margin-right:auto; text-align:center;>< / div>

< div class =fb-likedata-href ='。$ thepage [link3]。'data-send =falsedata-layout =button_countdata-width =90data-show-faces =falsedata-font =tahomastyle =margin-left:auto; margin-right:auto; text-align:center;>< / div>






xfbml按钮

 < fb:like href =http://anotherfeed.com?link=1send =truewidth =450show_faces =true >< / FB:像> 

< fb:like href =http://anotherfeed.com?link=2send =truewidth =450show_faces =true>< / fb:喜欢>

< fb:like href =http://anotherfeed.com?link=3send =truewidth =450show_faces =true>< / fb:喜欢>


I have one page with multiple news items. Every item in the list must have own Like button with count.

Is it possible to put multiple Like buttons with count for each news on same page?

解决方案

Each like button code will have to have it's own unique url.

refer to: http://developers.facebook.com/docs/reference/plugins/like/

I use php to achieve this, by pulling all relative urls needed from a database, looping them and writing return to the data-href param in the html5 like button code.

You can manually set these links or set up a dynamic system as i did.


html5 button code.

<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>


xfbml button

<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>

这篇关于如何将多个Facebook Like按钮与计数器放在同一页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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