问题
I wanted to add a Facebook like button to one of the pages of my website. However, I'm being bothered by this Server error 500. You see, when I click the Facebook like plugin, it opens up the facebook login box. I enter my login credentials and then the login box disappears and it momentarily displays up my FB profile image beneath the like button on the page. The image then vanishes and it displays a "Confirm" box which when clicked displays this Server 500 error.
Below is the code which I tried (and all of them fail)
1) Placed below just after <body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Placed at the position wherein I wanted the Flike button to get displayed.
<div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div>
2) <iframe src="https://www.facebook.com/plugins/like.php?href=MY_URL_HERE" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe>
I googled a lot for this but still no avail till I found this - http://mashable.com/2010/06/01/facebook-like-button-broken/
Can anyone please let me know what's wrong here? If this is a duplicate question, please link this up with the correct one here. Thanks.
回答1:
Apologies, since this is a very late response. Since you've tagged your question with yii
, let me try to give you a YII-alternative.
http://www.yiiframework.com/extension/faceplugs/ - This is a wrapper for Facebook plugins using the Open graph protocol and JavaScript SDK.
From the above page, insert the FB like button as -
$this->widget('ext.faceplugs.LikeButton', array(
'url' => $this->createAbsoluteUrl('/'),
'og' => $og,
'layout' => 'button_count',
'action' => 'recommend',
'colorscheme' => 'dark',
));
where , Open graph properties are passed to the plugin using $og
array.
Try this and let me know if it works for you.
来源:https://stackoverflow.com/questions/11932700/facebook-like-server-error-500