FBML不会在iframe的Facebook应用程序中呈现 - 请帮忙

时间:2010-04-15 13:17:15

标签: php facebook fbml facebook-fbml serverfbml

我正在用PHP开发一个Facebook应用程序。它作为iframe而不是FBML加载。与Facebook的正常互动有效。例如,以下代码给出了用户名:

$facebook = new Facebook($config->appapikey, $config->appsecret);
$user_id = $facebook->require_login($required_permissions = 'email');
echo $user->name;

其中$ user是我的类,其中从facebook加载用户详细信息。 我的文件以下列方式开始:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head><title>Appname</title>
</head>
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/de_DE" type="text/javascript"></script>

结局喜欢这个:

<script type="text/javascript">  
FB_RequireFeatures(['XFBML','CanvasUtil'], function(){ 
FB.init("<?php echo $config->appapikey; ?>", "/app/xd_receiver.htm");
FB.CanvasClient.startTimerToSizeToContent(); 
 });
  </script>
</body>
</html>

我也可以在Firebug中看到加载文件xd_receiver.htm。

但我的问题是,例如没有加载请求表单。我的代码:

<fb:serverFbml>
    <script type="text/fbml"> 
        <fb:fbml>
            <fb:request-form method="post" action="<?php echo $config->site; ?>index.php" type="appname" invite="true" target="_top" content="content">
                <fb:multi-friend-selector actiontext="text" rows="3" showborder="true" target="_top"/>
            </fb:request-form>
        </fb:fbml>
    </script>
</fb:serverFbml>

我可以使用Firebug查看代码,但Facebook不会显示该表单。

2或3周前它被显示但是在这个时候我有标签

    </fb:fbml>
</script>
</fb:serverFbml>

将我的全文放在身体里。 2周前我遇到的问题是没有显示任何内容。删除标签后,我的应用程序显示但不显示表单。

我现在正在搜索网络vor 1周,并在Facebook上阅读了很多关于FBML和XFBML的主题,但没有任何对我有用。

所以,请提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

哇,我不知道该说些什么。我只是看了你所有的代码,一切看起来都很到位。也许尝试添加这个

FB.XFBML.Host.autoParseDomTree = true;

在致电FB.init()

之后