Johan
Johan

Reputation: 39

Facebook app canvas page: Can't see FBML-like button

<!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>

Test-app url: http://www.facebook.com/pages/Trololo/236069739747588?sk=app_229260073773183

My problem: Can't see the like-button. Did I miss something?

Thanks!

Upvotes: 0

Views: 903

Answers (1)

squinlan
squinlan

Reputation: 1805

Try putting the fb-root before the php block AND the fb:like element.

<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>

Upvotes: 1

Related Questions