1
ADDING A PROFILE BOX USING IFRAME WITHIN A PHP APP (HOW TO?) Tue Sep 29, 2009 11:49 am
danilodeleon
![danilodeleon](https://2img.net/u/3413/74/71/65/avatars/10-86.jpg)
Administrative Team
![Administrative Team Administrative Team](https://2img.net/h/www.fileden.com/files/2008/4/23/1880826/Admin9.png)
This thing is alittle bit complicated to newbies:).
STEP 1: ADDING THE ADD TO PROFILE BUTTON
Step 1.1: Add the Javascript part
If you're using iframe, somewhere in your code you added the FB_RequireFeatures method. You need to add to this method:
Notice how the second parameter's name is "addProfileButton". You must add a div with that name in your code:
Self explanatory. The Post-Authorize Redirect URL must point to where you want your profile thing to load.
STEP 3: DECLARE THE METHOD YOU ASSIGNED IN STEP 2
STEP 1: ADDING THE ADD TO PROFILE BUTTON
Step 1.1: Add the Javascript part
If you're using iframe, somewhere in your code you added the FB_RequireFeatures method. You need to add to this method:
- Code:
FB.Connect.showAddSectionButton("profile", document.getElementById("addProfileButton"));
Notice how the second parameter's name is "addProfileButton". You must add a div with that name in your code:
- Code:
<div id="addProfileButton"></div>
Self explanatory. The Post-Authorize Redirect URL must point to where you want your profile thing to load.
STEP 3: DECLARE THE METHOD YOU ASSIGNED IN STEP 2
- Spoiler:
$ProfileContent = "BigBox";
$ProfileContent2 = "LittleBox";
$user = $facebook->get_loggedin_user();
// this variable/array should contain all the data for small profile box
$facebook->api_client->call_method('facebook.Fbml.setRefHandle',
array(
'handle' => 'bla_w',
'fbml' => $ProfileContent, // wide box
) );
$facebook->api_client->call_method('facebook.Fbml.setRefHandle',
array(
'handle' => 'bla_n',
'fbml' => $ProfileContent2, // narrow box and main box
) );
$facebook->api_client->call_method('facebook.profile.setFBML',
array(
'uid' => $user,
'profile' => '<fb:wide><fb:ref handle="bla_w" /></fb:wide><fb:narrow><fb:ref handle="bla_n" /></fb:narrow>',
'profile_main' => '<fb:ref handle="bla_n" />'
)
);
//REDIRECT TO YOUR MAIN PAGE HERE