I'm using Facebook Likes in my site. I have a gallery page which shows picture/video data and the number of likes for that data. Each piece of data has it's own URL which can be liked.
However, I want to display the number of likes in the gallery navigation, but I don't want people to be able to "like" from the navigation. Is开发者_C百科 there a way to display the number of likes without the button?
The only way I've seen so far is using the link stat "table" from FQL: http://developers.facebook.com/docs/reference/fql/link_stat/
Is there an easier way because this seems like a fair amount of work to implement.
You can :
1) collect the number of likes through the facebook graph yourself, save them in a DB and then display it on your own without FB.
Example : http://graph.facebook.com/http://www.huffingtonpost.com/
Or better : http://graph.facebook.com/http%3A%2F%2Fwww.huffingtonpost.com%2F
Which returns :
{
"id": "141265189223470",
"name": "The Huffington Post - Breaking News and Opinion",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/188056_141265189223470_1131566_s.jpg",
"link": "http://www.huffingtonpost.com/",
"category": "Personal blog",
"likes": 15,
"website": "http://www.huffingtonpost.com/",
"description": "Breaking News and Opinion"
}
And thus "likes": 15,
For some ressources you will need an access token and url encode your url if necessary, as it could lead to problems with complex urls.
2) Display the like button in iframe version and put another div on top so that user cannot interact with it, but I wouldn't recommend that as It might frustrate your user when he will try to like. (Users are accustomed to the fact that they can click on this)
I guess a third option would be to fetch the number of like in Javascript on the client each time your display the page also using the graph api
精彩评论