Facebook上的粉丝门应用程序网址+ Facebook标签显示空白

时间:2012-06-05 17:21:01

标签: facebook tabs fan-page

我在Facebook App上遇到了问题。 当任何人进入应用程序URL时,我想制作扇形门,例如。 apps.facebook.com/zoomcompetition /

我无法在标签上显示它,因为它显示为空白。 但它适用于应用程序网址,因此我想在应用程序指定Facebook页面上添加粉丝门。 这是代码

<?php

require 'src/facebook.php';
//require 'fbconfig.php';
require 'functions.php';

// Create An instance of our Facebook Application.
$facebook = new Facebook(array(
'appId' => ***************,
'secret' => **************,
));

// Get the app User ID
$user = $facebook->getUser();
if ($user) {
try {
// If the user is authenticated and logged-in
$user_profile = $facebook->api('/me');
//var_dump($user_profile);
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}

// If the user is authenticated then generate the variable for the logout URL
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();

?>

<!-- Insert Logged in HTML here -->
 <a href="<?php echo $logoutUrl; ?>">Logout</a>


 <?php
//Always place this code at the top of the Page

session_start();

if (!isset($_SESSION['id'])) {

// Redirection to login page  facebook

header("location: index.php");

}
echo ' Welcome '.$_SESSION['username'];  // or whatever you want your user to see.


$varri = "http://www.*****.ps";  
?>  

  <iframe src=<?php print $varri; ?> scrolling="auto" width=100% height=100% frameborder="0"> </iframe>


<?php
$user = $facebook->getUser();
if ($user) { 
 $ret_obj = $facebook->api('/me/feed', 'POST',
                                    array(
                                      'link' => 'https://www.************.com',

                                      'picture' => 'http://www.*******************.jpg',
                                      'caption' => "أهلا وسهلا!",

                                      'message' => ' Welcome '.$_SESSION['username'],


                                      'uid'=> $facebook->getUser()
                                 ));
}


?>


<?php
} else {
  $loginUrl = $facebook->getLoginUrl();
}


if (!empty($user_profile )) {

$username = $user_profile['name'];

$uid = $user_profile['id'];

$email = $user_profile['email'];

$user = new User();

$userdata = $user->checkUser($uid, 'facebook', $username,$email,$twitter_otoken,$twitter_otoken_secret);

if(!empty($userdata)){ 
session_start();

$_SESSION['id'] = $userdata['id'];

$_SESSION['oauth_id'] = $uid;

$_SESSION['username'] = $userdata['username'];

$_SESSION['email'] = $email;

$_SESSION['oauth_provider'] = $userdata['oauth_provider'];

//header("Location: home.php");
?>
<!--<!DOCTYPE>
<HTML>
<head>
<script> 
function run(){
    window.location.href = '/facebook/home.php';
}
</script>
</head>
<body onLoad="run()">
</body>
</html> -->
<?php
}

} else {

die("There was an error."); 
}

}

else {
// Generate a session if there is none.

$login_url = $facebook->getLoginUrl(array( 'scope' => ' read_stream, publish_stream, email'));
?>
<!DOCTYPE>
<HTML>
<head>
<script> 
function run(){
    window.location.href = '<?php echo $login_url ?>';
}
</script>
</head>
<body onLoad="run()">
</body>
</html>
<?php

}

?>

您能帮我解决以下问题之一:

  1. 我需要做什么才能使标签上没有显示“空白”? 2-如果有人去App,如何为特定的Facebook Pae制作扇形门 url直接?

1 个答案:

答案 0 :(得分:0)

  

我需要做什么才能使标签上没有显示“空白”?

生成一些输出而不是什么,我猜......?

  

如果有任何人直接访问App url,我如何为特定的Facebook Pae制作扇形门?

您可以通过JavaScript(top.location.href =“您的页面/应用程序ID组合的FB-Address”)从画布页面重定向到特定的页面/应用程序组合。要检查您是否在画布页面上,最简单的方法是在画布页面地址中为它添加一个额外的GET参数,然后您可以在代码中对其进行评估。