【发布时间】:2016-04-25 18:10:50
【问题描述】:
我正在尝试在我的网站上放置一个按钮,以允许我们的客户在我们的 Facebook 页面上发表评论。我需要这个按钮来打开一个类似于 FB.ui 提要对话框的对话框,但可以使用 Facebook 评论中使用的 5 星样式对评论进行评分?我可以用 php o javascript 做到这一点吗?
我的提要代码:
<script type="text/javascript">
x$.ready(function () {
x$('#share_button').click(function (e) {
e.preventDefault();
FB.ui(
{
method: 'feed',
name: '<?php echo $linkname;?>',
link: '<?php echo $link;?>',
<?php if (isset($campaign->facebook_image) && $campaign->facebook_image != '' && $campaign->facebook_image != null) { ?>
picture: '<?php echo 'bo.opinat.com' . DIRECTORY_SEPARATOR . 'facebookimages' . DIRECTORY_SEPARATOR . $campaign->id . DIRECTORY_SEPARATOR .$campaign->facebook_image; ?>',
<? } ?>
caption: '<?php echo $linkcaption;?>',
description: '<?php echo $linkdescription;?>'
},
function (response) {
if (response && !response.error_message) {
FB.api('/' + response.post_id, function (response) {
x$().xhr('<?php echo Yii::app()->createUrl('survey/saveSocialMediaPost', array('answer_id' => $answer->id, 'social_network' => 1, 'state' => 'P', 'user_id' => $campaignCenter->social_media_user)); ?>', {
method: 'POST',
async: true,
data: 'message=' + response.message + '&post_id=' + response.id,
});
console.log(response.message);
});
}
else {
x$().xhr('<?php echo Yii::app()->createUrl('survey/saveSocialMediaPost', array('answer_id' => $answer->id, 'social_network' => 1, 'state' => 'E', 'user_id' => $campaignCenter->social_media_user)); ?>', {
method: 'POST',
async: true,
data: 'message=' + response.error_message + '&post_id=' + response.error_code,
});
}
}
);
});
});
</script>
【问题讨论】:
-
常见问题:到目前为止,您尝试过什么?请包括您的研究和代码。
-
嗨 luschn,我想做的是在我的 Facebook 页面上自动提供客户的意见。我正在处理提要,但我需要添加评论星。
-
现在你失去了我。你想在 facebook 上发表评论吗?还是您想创建自己的星级评分系统?
-
仅用于发表评论。
-
那样的话,答案很简单
标签: facebook-graph-api facebook-javascript-sdk facebook-php-sdk