<?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>Thomas Gericke &#187; FBML</title>
	<atom:link href="http://www.thomasgericke.de/v4/interactive/blog/tag/fbml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thomasgericke.de/v4/interactive/blog</link>
	<description>Facts. Thoughts. Stories. A Blog.</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:42:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HOWTO: publishing content on newsfeeds using a facebook application</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/08/howto-publishing-content-on-newsfeeds-using-a-facebook-application/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/08/howto-publishing-content-on-newsfeeds-using-a-facebook-application/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 19:08:56 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=4271</guid>
		<description><![CDATA[Hi there!
Quite a while ago, I started writing my firs [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p>Quite a while ago, I started writing my first and own <a title="unfake.it's facebook application (216 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://apps.facebook.com/unfake_it/" target="_blank">facebook application</a>. I got stuck while trying to publish content to my own profile page and also to my friends&#8217; newsfeeds. I stumbled upon several problems. Either there was no content displayed, it was formatted in a wrong way, it was not published on my friends&#8217; newsfeeds or it even was published on behalf of my friends&#8217; username. It was quite strange to me and I could not find an easy documentation on how to do it the right way.</p>
<p>I played around with <a title="Stream.publish (256 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/Stream.publish" target="_blank">Stream.publish</a>, <a title="Feed.publishUserAction (206 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/Feed.publishUserAction" target="_blank">Feed.publishUserAction</a> or <a title="Notifications.send (220 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/Notifications.send" target="_blank">Notifications.send</a> &#8211; none of those functions did what I wanted them to do. This may be so, because I did not fully understand their purposes.</p>
<p><strong>So, this is my way to do it.</strong> I am using the <a title="FBJS (208 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/FBJS" target="_blank">FBJS</a> (FaceBook JavaScript) popup call <a title="Facebook.showFeedDialog (291 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/Facebook.showFeedDialog" target="_blank">Facebook.showFeedDialog</a>. This is truely (as far as I&#8217;m concerned) the best and easiest way.</p>
<p>First of all, I assume you are familiar with how to build an facebook application from scratch. If not, please read the <a title="developer's documentation (428 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://developers.facebook.com/get_started.php" target="_blank">developer&#8217;s documentation</a>.</p>
<p><strong><span style="text-decoration: underline;">Step 1: build and register your Feed Template Bundle</span></strong></p>
<ol>
<li>go to the <a title="Feed Template Console (533 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://developers.facebook.com/tools.php?feed" target="_blank">Feed Template Console</a></li>
<li>choose your application and hit &#8220;Next&#8221;</li>
<li>create a template for your &#8220;One Line Story&#8221; and hit &#8220;Next&#8221;</li>
<li>create a template for your &#8220;Short Story&#8221; and hit &#8220;Next&#8221;</li>
<li>create Action Links and hit &#8220;Next&#8221;</li>
<li>hit &#8220;Register Template Bundle&#8221;</li>
<li>copy and save the Template Bundle ID given in the popup (you will have to paste it into your application&#8217;s code later)</li>
</ol>
<p>When doing this, you may enter any text or even HyperText in the fields for the <strong>One Line</strong> or <strong>Short Story</strong>. You also may enter predefined tags such as <code>{*actor*}</code> or your own defined tags such as <code>{*foobar*}</code>. In the <strong>Sample Template Data</strong>, you may enter the tag definitions and display a preview. What you enter there and at this very moment has <em><strong>no effect on the content displayed within your application later</strong></em>! That&#8217;s just for previewing purposes. The real content will be defined later in your application&#8217;s script. Remember that! Some Examples for your Sample Template Data at this point may be:</p>
<p>
<pre class="brush: php">{&amp;quot;foobar&amp;quot;: &amp;quot;This is a foobar text&amp;quot;}</pre>
</p>
<p>Or a bit more complex:</p>
<p>
<pre class="brush: php">{&amp;quot;foolink&amp;quot;: &amp;quot;&amp;lt;a href=&amp;quot;http://www.google.com/&amp;quot;&amp;gt;Google&amp;lt;/a&amp;gt;&amp;quot;,&lt;/p&gt;
&lt;p&gt;&amp;quot;images&amp;quot;:[{&amp;quot;src&amp;quot;:&amp;quot;http://domain.com/image1.jpg&amp;quot;, &amp;quot;href&amp;quot;:&amp;quot;&amp;lt;a href=&amp;quot;http://www.facebook.com/&amp;quot;&amp;gt;http://www.facebook.com&amp;lt;/a&amp;gt;&amp;quot;},&lt;/p&gt;
&lt;p&gt;{&amp;quot;src&amp;quot;: &amp;quot;http://anotherdomain.com/image2.jpg&amp;quot;, &amp;quot;href&amp;quot;:&amp;quot;&amp;lt;a href=&amp;quot;http://www.facebook.com/&amp;quot;&amp;gt;http://www.facebook.com&amp;lt;/a&amp;gt;&amp;quot;}]}</pre>
</p>
<p>You see, e.g . the <code>{*images*}</code> tag is defined as some sort of array consisting of multiple SRC and HREF values. Attention: the special tag <code>{*images*}</code> is displayed automatically on Short Stories, you don&#8217;t need to call them!</p>
<p><strong><span style="text-decoration: underline;">2. write your application&#8217;s content</span></strong></p>
<p>
<pre class="brush: php">&lt;?PHP&lt;/p&gt;
&lt;p&gt;require_once &#039;facebook-platform/php/facebook.php&#039;;&lt;/p&gt;
&lt;p&gt;$appid = &#039;xxxxxxxxx&#039;; // your app ID&lt;/p&gt;
&lt;p&gt;$appapikey = &#039;XXXXXXXXXXXXXXXX; // your app key&lt;/p&gt;
&lt;p&gt;$appsecret = &#039;XXXXXXXXXXXXXXXX&#039;; // your app secret&lt;/p&gt;
&lt;p&gt;$template_bundle_id = &#039;xxxxxxxxxxxxxxxx&#039;; // the ID you got in Step 1&lt;/p&gt;
&lt;p&gt;$facebook = new Facebook($appapikey, $appsecret);&lt;/p&gt;
&lt;p&gt;$user_id = $facebook-&gt;require_login();&lt;/p&gt;
&lt;p&gt;echo &quot;&lt;p&gt;Hello, &lt;fb:name uid=\&quot;$user_id\&quot; useyou=\&quot;false\&quot; /&gt;!&lt;/p&gt;&quot;;&lt;/p&gt;
&lt;p&gt;?&gt;&lt;/p&gt;
&lt;p&gt;&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--&lt;/p&gt;
&lt;p&gt;    var template_bundle_id =&quot;&quot;;&lt;/p&gt;
&lt;p&gt;    var url=&quot;http://www.google.com/&quot;;&lt;/p&gt;
&lt;p&gt;    var user_message_prompt = &quot;Share this URL with your friends?&quot;;&lt;/p&gt;
&lt;p&gt;    var user_message = {value: &quot;wants to share a greate website.&quot;};&lt;/p&gt;
&lt;p&gt;    var image =&quot;http://www.google.com/intl/en_ALL/images/logo.gif&quot;;&lt;/p&gt;
&lt;p&gt;    var template_data = {&quot;url&quot;: url,&lt;/p&gt;
&lt;p&gt;                                  &quot;images&quot;: [{&#039;href&#039;: url, &#039;src&#039; : image}]};&lt;/p&gt;
&lt;p&gt;    Facebook.showFeedDialog(template_bundle_id, template_data, &#039;&#039;, &#039;&#039;, &#039;&#039;, user_message_prompt, user_message);&lt;/p&gt;
&lt;p&gt;// --&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;</pre>
</p>
<p><strong>This is it.</strong></p>
<p>Every time you call your application&#8217;s page, you&#8217;ll get a facebook popup asking you to display the content on your profile and even in your friends&#8217; newsfeeds. Of course, it does not make any sense to share some data every time you call your application&#8217;s canvas page, so you may want to add some more code to your application.</p>
<p>The text to be shared is the text you entered when registering the Template Bundle in Step 1. If you get an error, please make sure the defined variables (such as &#8220;url&#8221; or &#8220;images&#8221;) are valid and do exist. In other words: <strong>whatever you call in your Template Bundle, it has to be defined in your script</strong>.</p>
<p>Of course, you may generate the content dynamically from a database or any other source.</p>
<p>I hope this HOWTO helped.</p>
<p>Bye, T.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/08/howto-publishing-content-on-newsfeeds-using-a-facebook-application/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>unfake.it now with facebook integration</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 01:48:44 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[unfake plugin]]></category>
		<category><![CDATA[url shortening]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=4211</guid>
		<description><![CDATA[Hi there,

after several months, unfake.it has become [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>after several months, unfake.it has become even more important in the Web2.0 community. A few weeks ago, I was talking to some guys and co-workers about programming and such things. I then told about unfake.it and a co-worker of mine said, he somehow stubled upon <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/" title="(705 hits)">http://unfake.it/</a> and uses it irregular. That was quite funny to me.</p>
<p>I&#8217;ve had very few time the past months and since I got stuck on the half way because of some WordPress problems and also some problems with facebook&#8217;s API and FBML, there was no more development. But now I&#8217;m proud to announce that today, I released a completely new version including new features:</p>
<p><strong>WordPress plugin version 1.2</strong></p>
<p>The new <a title="WordPress plugin (603 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wordpress.org/extend/plugins/url-shortener-for-twitter-tools/" target="_blank">plugin</a> comes with its own settings page and adds two own tables to your WordPress installation. The main purpose is to let you configure, whether or not you wish to be taken to facebook and add the shortened URL for your new blog post (including a thumbnailed screenshot) to your facebook profile page and even in your friends newsfeeds.</p>
<p><strong>Facebook application</strong></p>
<p>unfake.it now has <a title="facebook application (216 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://apps.facebook.com/unfake_it/" target="_blank">its own facebook application</a> which lets you add shortened URLs, lists them as screenshots in a profile box, displays about new URLs on your profile wall and even tells your friends about it in their newsfeeds. Want an example? See:</p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_v12.png" title="(149 hits)"><img class="aligncenter size-full wp-image-4221" title="uf_v12" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_v12.png" alt="uf_v12" width="510" height="132" /></a></p>
<p>Since a few hundred URLs are shortened every single day, I also had to do some enhancements to the database structure and especially to the thumbnailing process. Just think about it: at the moment, we have more than 20,000 shortened URLs, each of them was once and initially thumbnailed, stored and is re-fetched every few days, if still hits occur. That&#8217;s a lot of traffic and a lot of CPU power. Just take a look how MySQL handlers and Apache traffic increased the last months:</p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_mysql_200908.png" title="(159 hits)"><img class="aligncenter size-full wp-image-4231" title="uf_mysql_200908" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_mysql_200908.png" alt="uf_mysql_200908" width="421" height="148" /></a></p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_apache_200908.png" title="(160 hits)"><img class="aligncenter size-full wp-image-4241" title="uf_apache_200908" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_apache_200908.png" alt="uf_apache_200908" width="420" height="147" /></a></p>
<p>You may see most recent stats at <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/stats.php" title="(392 hits)">http://unfake.it/stats.php</a>.</p>
<p>Please let me know, if you have any problems with the new version of the WordPress plugin and especially what you think about the facebook application.</p>
<p>Bye, T.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating profile boxes with a facebook app</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/03/updating-profile-boxes-with-a-facebook-app/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/03/updating-profile-boxes-with-a-facebook-app/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 21:52:33 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=1601</guid>
		<description><![CDATA[Hi there!

A few days ago, I started to write my firs [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p>A few days ago, I started to write <strong>my first own facebook application</strong>. It all went quite okay until one certain point: I wanted my application to update the profile box of the user, which uses the app at that single moment. And that wasn&#8217;t as easy, as I thought.</p>
<p>The problem was: after the profile box has been updated, <strong>all profile boxes of all users had the same content</strong> &#8211; the content of the user who last updated his profile box.</p>
<p>I will come to the solution later. First of all, a quick explanation of what I needed to do:</p>
<ol>
<li>I <strong>read the documentation</strong> of facebook&#8217;s application guide to understand the <a title="API (202 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/API" target="_blank">API</a> and the <a title="FBML (232 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wiki.developers.facebook.com/index.php/FBML" target="_blank">FBML language</a></li>
<li>I <strong>set up my own application</strong> using the <a title="step-by-step guide (428 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://developers.facebook.com/get_started.php" target="_blank">step-by-step guide</a></li>
<li>I <strong>set up my new application on my own host</strong> including facebook&#8217;s PHP libraries</li>
</ol>
<p><strong>Here&#8217;s the code step-by-step </strong>(just put all sniplets together)<strong>:</strong></p>
<p><strong><code>Code sniplet #1</code></strong></p>
<pre class="brush: php">require_once &#039;facebook-platform/php/facebook.php&#039;;

$appid = &#039;xxxxxxxxxxxx&#039;;
$appapikey = &#039;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#039;;
$appsecret = &#039;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#039;;

$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook-&gt;require_login();</pre>
<p><strong>Above:</strong> first of all, we need to include facebook&#8217;s <strong>PHP libraries</strong>, define several <strong>variables</strong> for our application, <strong>initialize our facebook object</strong> and <strong>retrieve the UID</strong> of the user who currently uses the application.</p>
<p><strong><code>Code sniplet #2</code></strong></p>
<pre class="brush: php">$fb_box = &quot;&lt;H4 class=&#039;box_header clearfix&#039;&gt;&lt;span&gt;&quot;;
$fb_box .= &quot;Hello World!&quot;;
$fb_box .= &quot;&lt;/span&gt;&lt;/H4&gt;&quot;;
$fb_box .= &quot;&lt;div&gt;I am &quot;;
$fb_box .= &quot;&lt;fb:name uid=\&quot;$user_id\&quot; useyou=\&quot;false\&quot; /&gt;.&quot;;
$fb_box .= &quot;Nice you&#039;re on my page.&lt;/div&gt;&quot;;
$fb_box .= &quot;Some more content in HTML or FBML...&quot;;</pre>
<p><strong>Above:</strong> we then define the <strong>content</strong> which we want to be displayed <strong>within the profile box</strong>. In this examble, it will be the name of the user, greeting the visitor.</p>
<p><strong><code>Code sniplet #3</code></strong></p>
<pre class="brush: php">$fb_box_handle = &#039;pb_&#039; . $appid . &#039;_&#039; . $user_id;</pre>
<p><strong>Above:</strong> this is <strong>important</strong>! At this point, I got stuck for a while. The reason was, facebook <strong>caches</strong> profile boxes content until the application&#8217;s canvas page is requested for the next time. <strong>The handle is very important</strong> for that caching mechanism, since it has to be <strong>a unique identifier</strong> for each application and each user. For that reason, I simply use the prefix &#8216;<strong>pb_</strong>&#8216; followed by the <strong>applications ID</strong> (defined above) and the <strong>UID</strong> of the current user (also defined above)!</p>
<p><strong><code>Code sniplet #4</code></strong></p>
<pre class="brush: php">$facebook-&gt;api_client-&gt;call_method(&#039;facebook.profile.setFBML&#039;,
array(
&#039;api_key&#039; =&gt; $appapikey,
&#039;v&#039; =&gt; &#039;1.0&#039;,
&#039;uid&#039; =&gt; $user_id,
&#039;profile&#039; =&gt; &#039;&lt;fb:narrow&gt;&lt;fb:ref handle=&quot;&#039; . $fb_box_handle . &#039;&quot; /&gt;&lt;/fb:narrow&gt;&#039;,
&#039;profile_main&#039; =&gt; &#039;&lt;fb:ref handle=&quot;&#039; . $fb_box_handle . &#039;&quot; /&gt;&#039;,
)
);</pre>
<p><strong>Above:</strong> the rest is quite simple. We make an <strong>API call</strong> to facebook and send our <strong>application key</strong>, the <strong>protocol version</strong>, the <strong>UID</strong> of the facebook user whose profile box ought to be updated and, of course, the <strong>content</strong> for that box. The content will be sent as the <strong>reference handle</strong> we defined earlier.</p>
<p>If you want to update multiple profile boxes with one single API call, I guess, this could work if you send an array containing the UIDs. If not, you can still get all those UIDs, walk through the array and perform multiple API calls. I read somewhere, some users had problem updating large numbers of profiles&#8230; Just give it a try.</p>
<p>Comments (if it worked for you or even if it didn&#8217;t) are appreciated <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><code>UPDATE because of comment #2:</code></p>
<p>The example above is about updating content in a users profile, <strong>not</strong> about setting up a profile box on a profile. You should read the manual carefully.</p>
<p>A user has to approve a certain application to create a profile box. Therefore, you need to <strong>render a button</strong>, which sets up the box.  You can easily do this by:</p>
<pre class="brush: php">$appapikey = &#039;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#039;;
$appsecret = &#039;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#039;;
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook-&gt;require_login();
$facebook-&gt;api_client-&gt;profile_setFBML($appapikey, $user_id, &#039;profile&#039;, NULL, &#039;mobile_profile&#039;, &#039;profile_main&#039;);
echo &quot;&lt;fb:add-section-button section=&#039;profile&#039; /&gt;&quot;;</pre>
<p>The last line renders the button, you want to have on your canvas page.</p>
<p>Good luck!  Thomas</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/03/updating-profile-boxes-with-a-facebook-app/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

