fruity_looper
Junior Member
- Feb 19, 2010
- 143
- 73
I've seen a few threads asking for this and promised I'd share it! 
As most of you know FBML is being deprecated, so this code no longer works.
Here's what's needed:
Create a new application by going to:
Click Set Up New App
Enter a name for the application
Click Agree to the TOS
Click Create Application
Enter the Captcha
You will be leaded to you application setup page
Click the Facebook Intergration tab
Give a Canvas Page name (custom URL for your app)
Give a You are going to need to make a folder on your site for your
Canvas URL (eg. http://www.test.com/iframe/ ) and then put that in as your Canvas URL
Change the iframe size to Auto-Resize (i just do that, up to you though)
Go down to the Page Tabs area:
Insert a Tab Name (eg. Welcome!)
For your Tab URL put the exact same link as you did for the Canvas URL
Save it so far.
Step 2
The code and setup
First step is to create a folder (eg. I called mine iframe)
Inside that folder create a php file, we'll call it index.php
Copy/Paste this code into index.php
NOTES:
Next step is you will have to download and install the PHP SDK
https://github.com/facebook/php-sdk/zipball/v3.0.1
Extract all the files:
What we want from this is EVERYTHING in the src folder
Put the files from the src folder into your iframe folder online
That means:
base_facebook.php
fb_ca_chain_bundle.crt
facebook.php
all in /iframe
(DON'T do this /iframe/src please, it won't work)
Copy/Paste this code into fb_init.php
Change
/home/monkey/public_html/iframe/facebook.php
to your directory.
Mine was shorter like
monkey/public_html/iframe/facebook.php
After that's done. You've setup the code!!! YAY!!!
Step 3
Setup landing.html and next.html with the things you want to show!
landing.html is the content for the person who has NOT liked the page yet
next.html is the content for the person who liked the page
I Hope this has helped people!
If there is anything wrong please tell me by POSTING HERE
If it was of use feel free to thank me and/or give me some rep
Enjoy!
As most of you know FBML is being deprecated, so this code no longer works.
Code:
Non-fan content (eg. Like this page to see a monkey fly
<fb:visible-to-connection>
Fan content (eg. a flying monkey)
</fb:visible-to-connection>
__________________________________________________
Here's what's needed:
- A place to host files
- A FB PVA so you can create applications
- Time and willingness to read/follow these steps.
__________________________________________________
Step 1Create a new application by going to:
Code:
http://www.facebook.com/developers/
Enter a name for the application
Click Agree to the TOS
Click Create Application
Enter the Captcha
You will be leaded to you application setup page
Click the Facebook Intergration tab
Give a Canvas Page name (custom URL for your app)
Give a You are going to need to make a folder on your site for your
Canvas URL (eg. http://www.test.com/iframe/ ) and then put that in as your Canvas URL
Change the iframe size to Auto-Resize (i just do that, up to you though)
Go down to the Page Tabs area:
Insert a Tab Name (eg. Welcome!)
For your Tab URL put the exact same link as you did for the Canvas URL
Save it so far.
__________________________________________________
Step 2
The code and setup
First step is to create a folder (eg. I called mine iframe)
Inside that folder create a php file, we'll call it index.php
Copy/Paste this code into index.php
Code:
<?php
include_once('fb_init.php');
// create the Facebook Graph SDK object
require_once('facebook.php');
$facebook = new Facebook(array(
'appId'=>'[B]ENTER YOU APP ID HERE[/B]', // replace with your value
'secret'=>'[B]ENTER YOUR APP SECRET HERE[/B]' // replace with your value
));
$signedRequest = $facebook->getSignedRequest();
// Inspect the signed request
if($signedRequest['page']['liked'] == 1){
// Show the content for the person who liked the page
print '<script type="text/javascript">
<!--
window.location = "[B]http://www.test.com/iframe/next.html[/B]"
//-->
</script>';
} else {
// Show the reveal ask content
print '<script type="text/javascript">
<!--
window.location = "[B]http://www.test.com/iframe/landing.html[/B]"
//-->
</script>';
}
?>
- Please enter your App ID and App Secret into this code where stated.
- Please change the http://www.test.com/iframe/next.html to your website and create a html , call it next.html
- Please change the http://www.test.com/iframe/landing.html to your website and create a html , call it landing.html
__________________________________________________
Next step is you will have to download and install the PHP SDK
https://github.com/facebook/php-sdk/zipball/v3.0.1
Extract all the files:
What we want from this is EVERYTHING in the src folder
Put the files from the src folder into your iframe folder online
That means:
base_facebook.php
fb_ca_chain_bundle.crt
facebook.php
all in /iframe
(DON'T do this /iframe/src please, it won't work)
__________________________________________________
Inside the folder iframe create a php file, called fb_init.php
Copy/Paste this code into fb_init.php
Code:
<?php
// depending on your hosting provider, you may need to include
// the entire path to the directory you added this file to, for example
// if your FTP login is, '[B]monkey[/B]', it may be, consult your ISP's docs
// for additional assistance:
// require_once('/home/monkey/public_html/iframe/facebook.php');
require_once('facebook.php');
$facebook = new Facebook(array(
'appId'=>'', // from Facebook
'secret'=>'', // from Facebook
'cookie'=>true
));
?>
/home/monkey/public_html/iframe/facebook.php
to your directory.
Mine was shorter like
monkey/public_html/iframe/facebook.php
After that's done. You've setup the code!!! YAY!!!
__________________________________________________
Step 3
Setup landing.html and next.html with the things you want to show!
landing.html is the content for the person who has NOT liked the page yet
next.html is the content for the person who liked the page
__________________________________________________
I Hope this has helped people!
If there is anything wrong please tell me by POSTING HERE
If it was of use feel free to thank me and/or give me some rep
Enjoy!
Last edited: