Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't need to parse the <code>signed_request</code> if you are using the PHP-SDK as it'll take care of that for you. You just need to retrieve the user (<code>getUser()</code>) and if no user, redirect to the login url (refer to the <a href="https://github.com/facebook/php-sdk/blob/master/examples/example.php" rel="nofollow">example</a> file). </p> <p>Here is a better code: </p> <pre><code>&lt;?php include ('src/facebook.php'); $app_id = "xxx"; $application_secret = 'xxx'; $canvas_page = "xxx"; $facebook = new Facebook(array( 'appId' =&gt; $app_id, 'secret' =&gt; $application_secret )); $user = $facebook-&gt;getUser(); if(!$user) { $loginUrl = $facebook-&gt;getLoginUrl(array( 'redirect_uri' =&gt; $canvas_page, 'scope' =&gt; 'publish_stream,offline_access' )); echo("&lt;script&gt; top.location.href='" . $loginUrl . "'&lt;/script&gt;"); exit; } $_SESSION['on'] = 1; $files = array(); $files['RE'] = 'xxx.php'; $files['RC'] = 'yyy.php'; $files['DP'] = 'zzz.php'; try { $me = $facebook-&gt;api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; } ?&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" xmlns:fb="https://www.facebook.com/2008/fbml"&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;meta property="og:title" content="title" /&gt; &lt;meta property="og:description" content="description" /&gt; &lt;meta property="og:image" content="thumbnail_image" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="wrapper"&gt; &lt;?php include("inc/app_header.php");?&gt; &lt;div class="content"&gt; &lt;?php if(isset($_GET['section'])) { $file_to_include = 'inc/'.$files[$_GET['section']]; } else { $file_to_include = 'inc/section_restaurantes.php'; } include($file_to_include); ?&gt; &lt;div class="content_bottom_space"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="footer"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Now for your restaurant section, I would link to the parent document: </p> <pre><code>&lt;div class="section_restaurantes"&gt; &lt;div class="restaurantes_container"&gt; &lt;div class="restaurantes"&gt;&lt;a href="&lt;?php echo $canvas_page; ?&gt;?section=DP" target="_top"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="restaurantes"&gt;&lt;a href="&lt;?php echo $canvas_page; ?&gt;?section=PH" target="_top"&gt;&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Assuming your <code>$canvas_page</code> is the intended destination. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload