<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook Cookbook &#187; iFrame</title>
	<atom:link href="http://fbcookbook.ofhas.in/tag/iframe/feed/" rel="self" type="application/rss+xml" />
	<link>http://fbcookbook.ofhas.in</link>
	<description>thousands of app development recipes</description>
	<lastBuildDate>Sun, 21 Mar 2010 10:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>fbml rendering in iframe application</title>
		<link>http://fbcookbook.ofhas.in/2009/02/03/fbml-rendering-in-iframe-application/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/03/fbml-rendering-in-iframe-application/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 16:26:23 +0000</pubDate>
		<dc:creator>Mahmud Ahsan</dc:creator>
				<category><![CDATA[FBML]]></category>
		<category><![CDATA[iFrame]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbml in iframe]]></category>
		<category><![CDATA[xfbml]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=57</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/03/fbml-rendering-in-iframe-application/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'fbml rendering in iframe application';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
before proceeding the main topic, at first i want to describe how to develop  iframe based facebook application. i assume that, the reader have minimum knowledge of how to develop canvas based facebook application. if you never develop any facebook application please visit: http://wiki.developers.facebook.com/index.php/creating_your_first_application
steps of developing iframe based facebook application:
1. when you setup a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/03/fbml-rendering-in-iframe-application/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'fbml rendering in iframe application';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>before proceeding the main topic, at first i want to describe how to develop  iframe based facebook application. i assume that, the reader have minimum knowledge of how to develop canvas based facebook application. if you never develop any facebook application please visit:<a href="http://wiki.developers.facebook.com/index.php/creating_your_first_application" target="_blank"> http://wiki.developers.facebook.com/index.php/creating_your_first_application</a></p>
<p>steps of developing iframe based facebook application:</p>
<p>1. when you setup a new application in facebook, choose  “use iframe” for canvas page url.<br />
2. now set the authentication code, at your bootstrap file:</p>
<pre name="code" class="php">

&lt;?php
include “facebook.php”;
$facebook = new facebook(’api_key’, ’secret_key’);
$user = $facebook-&gt;require_login();

//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
if (!$facebook-&gt;api_client-&gt;users_isappadded()) {
$facebook-&gt;redirect($facebook-&gt;get_add_url());
}
}
catch (exception $ex) { //this will clear cookies for your application and redirect them to a login prompt
$facebook-&gt;set_user(null, null);
$facebook-&gt;redirect(callback_url);
}
?&gt;
</pre>
<p>3. and don’t forget to place the necessary facebook php library. <a href="http://wiki.developers.facebook.com/index.php/php">http://wiki.developers.facebook.com/index.php/php</a></p>
<p>now i’m describing the main topic, that is how to render xfbml or fbml in your iframe based application.</p>
<p>1. first create a file called xd_receiver.htm<br />
2. place xd_receiver.htm in the root directory. suppose your application base directory is: <a href="http://myapp.com/iframeapp">http://myapp.com/iframeapp</a> . then place <strong>xd_receiver.htm</strong> in <strong>iframeapp </strong>folder.  now add the following html code to xd_receiver.htm .</p>
<pre name="code" class="html">

&lt;!doctype html public “-//w3c//dtd xhtml 1.0 strict//en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd”&gt;
&lt;html xmlns=”http://www.w3.org/1999/xhtml” &gt;
&lt;head&gt;
&lt;title&gt;cross-domain receiver page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script src=”http://static.ak.facebook.com/js/api_lib/v0.4/xdcommreceiver.debug.js” type=”text/javascript”&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>now in your view file, or may be layout file, place this code. here i’m showing the layout files format for iframe application.</p>
<pre name="code" class="html">

&lt;!doctype html public “-//w3c//dtd xhtml 1.0 strict//en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd”&gt;
&lt;html xmlns=”http://www.w3.org/1999/xhtml” xmlns:fb=”http://www.facebook.com/2008/fbml”&gt;

&lt;head&gt;
&lt;script src=”http://static.ak.facebook.com/js/api_lib/v0.4/featureloader.js.php” type=”text/javascript”&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;!– here is the fbml code in iframe application –&gt;

&lt;fb:serverfbml&gt;
&lt;script type=”text/fbml”&gt;
&lt;fb:fbml&gt;

&lt;fb:request-form action=”&lt;url for post invite action, see wiki page for fb:request-form for   details&gt;” method=”post” invite=”true” type=”xfbml” content=”this is a test invitation from xfbml test app &lt;fb:req-choice url=’see wiki page for fb:req-choice for details’ label=’ignore the connect test app!’ /&gt;  ” &gt;  &lt;fb:multi-friend-selector showborder=”false” actiontext=”invite your friends to use connect.”&gt;  &lt;/fb:request-form&gt;
&lt;/fb:fbml&gt;
&lt;/script&gt;
&lt;/fb:serverfbml&gt;
</pre>
<p><strong>&lt;!– here is the xfbml code –&gt;</strong></p>
<pre name="code" class="html">

this is &lt;fb:name uid=”&lt;?=$this-&gt;userid?&gt;” useyou=’false’&gt; &lt;/fb:name&gt;
my photo &lt;fb:profile-pic uid=”&lt;?=$this-&gt;userid?&gt;” &gt; &lt;/fb:profice-pic&gt;

&lt;!– remember all xfbml tags should be placed before below javascript code –&gt;

&lt;script type=”text/javascript”&gt;
fb_requirefeatures([&quot;xfbml&quot;], function(){
fb.facebook.init(”place here the api key of your application“, “xd_receiver.htm”);
});
&lt;/script&gt;

&lt;/body&gt;

&lt;/html&gt;
</pre>
<p>** <strong>remember xfbml is nothing but a subset of fbml that are supported for iframe application.</strong></p>
<p><strong>&lt;fb:serverfbml&gt;</strong> : this tag is used to renders the fbml on a facebook server inside an iframe. details of this tag is here: <a href="http://wiki.developers.facebook.com/index.php/fb:serverfbml">http://wiki.developers.facebook.com/index.php/fb:serverfbml</a></p>
<p>references:</p>
<p>1. <a href="http://wiki.developers.facebook.com/index.php/xfbml">http://wiki.developers.facebook.com/index.php/xfbml</a><br />
2. <a href="http://wiki.developers.facebook.com/index.php/cross-domain_communication_channel">http://wiki.developers.facebook.com/index.php/cross-domain_communication_channel</a><br />
3. <a href="http://wiki.developers.facebook.com/index.php/php">http://wiki.developers.facebook.com/index.php/php</a><br />
4. <a href="http://wiki.developers.facebook.com/index.php/creating_your_first_application">http://wiki.developers.facebook.com/index.php/creating_your_first_application</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/03/fbml-rendering-in-iframe-application/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
