I've converted a Facebook app from FBML to iFrame (with PHP SDK) and now have vertical scrollbars displayed for the same amount of content I had before (a logo, a flash game and a line with 3 links below). But earlier I didn't have any scrollbars.
If I set the app setting Auto-Resize, then the lower part of content isn't displayed at all - which is bad, the flash game is unplayable then.
I've searched around and all suggested solutions involve Javascript, but I'm actually using PHP SDK. Isn't there a solution for PHP/CSS only?
Below my current code:
<?php
require_once('facebook.php');
define('FB_API_ID', 'XXX');
define('FB_AUTH_SECRET', 'XXX');
$facebook = new Facebook(array(
'appId' => FB_API_ID,
'secret' => FB_AUTH_SECRET,
'cookie' => true,
));
if (! $facebook->getSession()) {
printf('<script type="text/javascript">top.location.href="%s";</script>',
$facebook->getLoginUrl(
array('canvas' => 1,
'fbconnect' => 0,
#'req_perms' => 'user_location',
)));
exit();
} else {
try {
$me = $facebook->api('/me');
$first_name = $me['first_name'];
$city = $me['location']['name'];
$female = ($me['gender'] == 'male' ? 0 : 1);
$avatar = 'http://graph.facebook.com/' . $me['id'] . '/picture?type=large';
} catch (FacebookApiException $e) {
exit('Facebook error: ' . $e);
}
}
# print the logo, the flash game and 3 links
?>
Also I'm not sure if my PHP-script is supposed to print
<html>
<body>
.....
</body>
</html>
? Currently I only print what's inside the body.
And I wonder if it is a good idea to replace top.location.href=.... in my code by PHP's header('Location: ....');?
header
won't work because you are working inside an iframe 2) you should wrap all FB related JS functions inside thewindow.fbAsyncInit
method (I mean here theFB.init
) – Quinonez