Facebook 点赞按钮
我正在尝试向页面上上传的所有图像添加一个“赞”按钮。我以某种方式让它工作了.. 当我点击其中一个按钮上的“喜欢” 时,所有“喜欢”按钮都显示“1 喜欢这个”。 就好像它们都以某种方式联系在一起。
http://www.puffys.net
这就是我遇到问题的地方。我想你会明白我的意思。
我该如何解决这个问题?
我的代码如下所示:
while($row = mysql_fetch_array($result)){
echo '
<div align"center" class="images" id="images'.$i.'">
<a class="image" border="0" href="'.$row['path'].'">
<img class="img" src="'.$row['path'].'" alt="image" />
</a>
<div class="meta" style="padding-bottom:5px;">Lastet opp av <div style="color:#47a09f; display:inline;">'.$row['uploader'].'</div>
</div>
<div id="fb-root" style="display:inline;"></div>
<script>
(function(d){
var js, id = \'facebook-jssdk\'; if (d.getElementById(id)) {return;}
js = d.createElement(\'script\'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#appId=144501772249167&xfbml=1";
d.getElementsByTagName(\'head\')[0].appendChild(js);
}(document));
</script>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="0" data-show-faces="false" data-font="tahoma"></div>
</div>
';
I'm trying to add a like button to all the images uploaded on a page. I got it working, somehow..
When I click like
on one of the buttons, all the like buttons says 1 likes this
.
It's like they're all connected somehow.
http://www.puffys.net
That's where I have the problems. I think you will see what I mean.
How can I fix this?
My code looks like this:
while($row = mysql_fetch_array($result)){
echo '
<div align"center" class="images" id="images'.$i.'">
<a class="image" border="0" href="'.$row['path'].'">
<img class="img" src="'.$row['path'].'" alt="image" />
</a>
<div class="meta" style="padding-bottom:5px;">Lastet opp av <div style="color:#47a09f; display:inline;">'.$row['uploader'].'</div>
</div>
<div id="fb-root" style="display:inline;"></div>
<script>
(function(d){
var js, id = \'facebook-jssdk\'; if (d.getElementById(id)) {return;}
js = d.createElement(\'script\'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#appId=144501772249167&xfbml=1";
d.getElementsByTagName(\'head\')[0].appendChild(js);
}(document));
</script>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="0" data-show-faces="false" data-font="tahoma"></div>
</div>
';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我本来打算写一些代码,但我发现你已经成功了。
澄清一下,每个“赞”都适用于 URI。在你的例子中,所有的点赞都指向同一个 URI。
I was going to write up some code, but I see you got it working.
To clarify, each 'like' applies to a URI. In your case, all the likes were pointing to the same URI.