Facebook app canvas页面:看不到类似FBML的按钮

时间:2011-07-18 13:59:11

标签: facebook fbml facebook-javascript-sdk

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com /2008/fbml">
<head>
<style>
body { font: 12px Calibri; }
</style>
</head>
<body>

<fb:like href="http://www.facebook.com/pages/Trololo/236069739747588?sk=app_229260073773183"  width="450" show_faces="false" font="arial">    </fb:like>

<?php
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

if (empty($data["page"]["liked"])) {
//Does not like
} else {
//Likes
}


?>

<div id="fb-root"></div><script src="http://connect.facebook.net/se_SV /all.js#appId=113202612108305&amp;xfbml=1"></script>

<script type="text/javascript">

$(function() {

FB.init({appId: '229260073773183', status: true, cookie: true, xfbml: true});

FB.Event.subscribe('edge.create', function(response) {
    //clicked "like"
});

FB.Event.subscribe('edge.remove', function(response) {
    //clicked "unlike"
});

});

</script>
</body>
</html>

测试应用网址:http://www.facebook.com/pages/Trololo/236069739747588?sk=app_229260073773183

我的问题:看不到像按钮。我错过了什么吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试将fb-root放在php块和fb:like元素之前。

<body>
<div id="fb-root"></div><script src="http://connect.facebook.net/se_SV /all.js#appId=113202612108305&amp;xfbml=1"></script>
<fb:like href="http://www.facebook.com/pages/Trololo/236069739747588?sk=app_229260073773183"  width="450" show_faces="false" font="arial">    </fb:like>