Facebook Comments Plugin for different articles on IP.Content
I'm trying to add f开发者_运维百科acebook comments plugin to the IP.Content articles with following code
<html>
<head>
<meta property="fb:app_id" content="{YOUR_APPLICATION_ID}">
</head>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</script>
<body>
<div id="fb-root"></div>
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>
</body>
</html>
Can anyone explain me what is YOUR_CANONICAL_URL ? If I'm putting my website url , anyone who commets the article that shares the meta description of my main page on the his wall.
What link I need to insert to make displaying the link to the article on anyone who commets wall.
There was something like <?php echo rand(); ?>
to be added to the link....but I'm not quite good in that php tricks....
Also I'm putting that code into global articles view template. But for that reason comments are the same for all articles. How can I make them be different for each article ?
Thank you for any replies on that subject...
I added fb comments to my website (php script/ smarty engine) and when you write a comment it's only for the page/article you are on with this code
`<div class="fb-comments" data-href="http://yourdomain/{$smarty.server.REQUEST_URI}" data-num-posts="5" data-width="550"></div>`
I don't see an href attribute in the official docs for fb:comments seen here: http://developers.facebook.com/docs/reference/fbml/comments/
To differentiate comments on different items you are supposed to use the xid attribute. This tells Facebook what "item" (page, post, product, etc) people are commenting on. The docs hint that you can use any url encoded string as an xid, so maybe you could do something like this:
function get_my_url()
{
global $HTTP_HOST;
global $REQUEST_URI;
if (!empty($_SERVER['HTTPS']))
$protocol = 'https';
else
$protocol = 'http';
return "${protocol}://${HTTP_HOST}${REQUEST_URI}";
}
$xid = urlencode(get_my_url());
?>
<fb:comments xid="<?= $xid; ?>"></fb:comments>
精彩评论