Facebook 点赞按钮,用于点赞索引/列表页面上的各个内容项
我们希望实现一个包含内容项列表的页面,显示每个内容项的标题和摘录。我们希望每个内容项旁边都有一个“喜欢”按钮,单击该按钮时,“喜欢”单个项目,而不是索引页。
我们已经在其他地方看到了这个实现(以前是 Mashable.com,在他们的主页上),但是使用标准实现我们无法让它工作。有人有什么建议吗?
我们正在使用 PHP/Symfony。
注意:我不是程序员,所以这个问题不是用技术语言来表达的——但是任何答案都将传递给能够理解它们的程序员。
We wish to implement a page with a list of content items, showing a title and excerpt for each one. We want to have a Like button next to each content item, which, when clicked, "likes" the individual item, rather than the index page.
We've seen this implemented elsewhere (formerly Mashable.com, on their homepage), but using a standard implementation we can't get it to work. Does anybody have any tips?
We are using PHP/Symfony.
NB: I'm not a programmer so this question isn't framed in technical language - however any answers will be passed to programmers who will be able to understand them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在页面上的每个“like”按钮上设置 href 属性即可。例如,
如果每个按钮都有自己的 href,那么每个按钮将独立运行。如果您不包含 href,则“赞”按钮会假定您喜欢正在查看的当前页面。
此外,您应该在您喜欢的每个网址上实施开放图形协议。我指的是“赞”按钮的 href 中的 url,而不是“赞”按钮所在的页面。您可以在这里阅读相关内容:http://developers.facebook.com/docs/opengraph
做起来很简单。您只需将元标记添加到页面标题中,如下所示:
You just need to set the href attribute on each like button on your page. For example,
If each button has its own href then each button will behave independently. If you don't include the href then the like button assumes you are liking the current page you are viewing.
Additionally, you should implement the open graph protocol on each url you have a like for. By this I mean the url in your like button's href, not the necessarily page the like button is on. You can read about this here: http://developers.facebook.com/docs/opengraph
It is pretty simple to do. You just add meta tags to your pages header like this:
将其放在每个内容之后:
将“unique_url_here_for_the_content”替换为内容的实际 url
要修改 data-* atrribute,请转到 fb like 插件页面 这里
当然你需要在 body 标签之后使用它
Put this after each content:
replace "unique_url_here_for_the_content" with the actual url of the content
To modify data-* atrribute please go to fb like plugin page here
and of couse you need to use this after the body tag