<?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>Thought Labs Blog &#187; Programming</title>
	<atom:link href="http://www.thoughtlabs.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thoughtlabs.com</link>
	<description>A blog about Social Media by John Maver and Cappy Popp</description>
	<lastBuildDate>Tue, 22 Jun 2010 17:10:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Our book, Essential Facebook Development, has been released</title>
		<link>http://www.thoughtlabs.com/2009/11/20/our-book-essential-facebook-development-has-been-released/</link>
		<comments>http://www.thoughtlabs.com/2009/11/20/our-book-essential-facebook-development-has-been-released/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 16:28:10 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Facebook Applications]]></category>
		<category><![CDATA[Facebook Platform]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/?p=526</guid>
		<description><![CDATA[
Our book, Essential Facebook Development, is now available.
The synopsis:
With more than 300 million active users, Facebook is the world’s #1 social networking platform. But developing successful Facebook applications presents unique challenges, both technical and nontechnical. Now, two of the world’s most experienced Facebook developers show you exactly how to meet those challenges. Essential Facebook Development [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.thoughtlabs.com/2009/11/20/our-book-essential-facebook-development-has-been-released/" title="Permanent link to Our book, Essential Facebook Development, has been released"><img class="post_image alignleft" src="http://www.thoughtlabs.com/wp-content/uploads/2009/11/fbcover.jpg" width="384" height="524" alt="Post image for Our book, Essential Facebook Development, has been released" /></a>
</p><p>Our book, Essential Facebook Development, is now available.</p>
<p>The synopsis:<br />
With more than 300 million active users, Facebook is the world’s #1 social networking platform. But developing successful Facebook applications presents unique challenges, both technical and nontechnical. Now, two of the world’s most experienced Facebook developers show you exactly how to meet those challenges. Essential Facebook Development offers insider guidance and up-to-the-minute best practices for the entire application lifecycle: design, coding, testing, distribution, post-launch monitoring, metrics, and even application marketing.</p>
<p>Using extensive real-world examples, John Maver and Cappy Popp reveal why some Facebook applications succeed brilliantly while others fail. Next, they walk through building a complete application using every major component of the Facebook platform. Maver and Popp thoroughly cover Facebook’s most important new features, including Facebook Connect, and provide extensive information available nowhere else–from measuring application success to monetization. Coverage includes</p>
<ul>
<li>Thorough introductions to Facebook’s current architecture, integration points, and development technologies</li>
<li>Discussion of successful Facebook applications–and what makes them successful</li>
<li>What every developer must know about Facebook’s Terms of Service</li>
<li>Creating an effective application infrastructure</li>
<li>Creating canvas pages with FBML and IFrames</li>
<li>Adding support for profiles, application tabs, and messaging</li>
<li>Incorporating JavaScript into Facebook applications with FBJS</li>
<li>Integrating Facebook into external sites with Facebook Connect and the Facebook JavaScript Client Library</li>
<li>Debugging techniques for Facebook applications</li>
<li>Spreading, monitoring, and tuning applications</li>
</ul>
<p>You can purchase the book from the following sellers and more:</p>
<p><a href="http://www.amazon.com/gp/product/0321637984?ie=UTF8&amp;tag=thoughtlabs-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321637984"><img src="http://www.thoughtlabs.com/wp-content/uploads/2009/11/book-seller-amazon.jpg" alt="Amazon.com" /></a> <a href="http://clickserve.cc-dt.com/link/click?lid=41000000029424378"><img src="http://www.thoughtlabs.com/wp-content/uploads/2009/11/book-seller-bn.jpg" alt="BarnesAndNoble.com" /></a> <a href="http://click.linksynergy.com/fs-bin/click?id=6WlR9k64Rr4&amp;offerid=163217.1324935&amp;type=2&amp;subid=0"><img src="http://www.thoughtlabs.com/wp-content/uploads/2009/11/book-seller-informit.jpg" alt="informit.com" /></a></p>
<p>Stay up to date on what is happening with Facebook development and the book by becoming a Fan on its Facebook Public Profile, subscribing to the blog on the book&#8217;s website, or following the book&#8217;s updates on Twitter.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=526&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2009/11/20/our-book-essential-facebook-development-has-been-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook&#8217;s Next Steps: Facebook&#8217;s Roadmap for 2009</title>
		<link>http://www.thoughtlabs.com/2009/10/28/facebooks-next-steps-facebooks-roadmap-for-2009/</link>
		<comments>http://www.thoughtlabs.com/2009/10/28/facebooks-next-steps-facebooks-roadmap-for-2009/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 04:06:30 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Strategy]]></category>
		<category><![CDATA[Facebook Open Graph API]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/?p=508</guid>
		<description><![CDATA[
Today Facebook presented a 6-month developer roadmap. Finally &#8211; it&#8217;s been frustrating as hell writing a book about Facebook and not knowing what was coming from them and when, not to mention staying abreast of all the changes for our clients. In their presentation Facebook said that there were not many or big changes being [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.thoughtlabs.com/2009/10/28/facebooks-next-steps-facebooks-roadmap-for-2009/" title="Permanent link to Facebook&#8217;s Next Steps: Facebook&#8217;s Roadmap for 2009"><img class="post_image alignleft" src="http://www.thoughtlabs.com/wp-content/uploads/2009/10/wiki_logo.png" width="124" height="155" alt="Post image for Facebook&#8217;s Next Steps: Facebook&#8217;s Roadmap for 2009" /></a>
</p><p>Today Facebook presented a <a href="http://developers.facebook.com/news.php?blog=1&amp;story=326" target="_blank">6-month developer roadmap</a>. Finally &#8211; it&#8217;s been frustrating as hell <a href="http://www.informit.com/store/product.aspx?isbn=0321638166" target="_blank">writing a book about Facebook</a> and not knowing what was coming from them and when, not to mention staying abreast of all the changes for our clients. In their presentation Facebook said that there were not many or big changes being announced, but I beg to differ. Some of them are quite significant. I&#8217;ll be covering those changes over the coming weeks and how they will affect your business, personal, and application presences on Facebook. What&#8217;s great is that Facebook is actually giving developers a heads-up for the next six months, and making that information public to all. That&#8217;s fantastic. If only I had this before I started writing the book.</p>
<p>Let&#8217;s get to the meat of it.</p>
<p>What&#8217;s chopped? What&#8217;s not? The first  big change, for both developers and users, center around the Facebook Stream and communication channels. Facebook is offering a new one, which is big news, and taking away some old ones, which is, perhaps, bigger news&#8230;</p>
<p><img style="float: left; margin-left: 5px; margin-right: 15px;" src="http://www.thoughtlabs.com/wp-content/uploads/2009/10/notifications.png" alt="Facebook's Notifications menu" width="232" height="390" /></p>
<p><strong>The Stream</strong></p>
<p>Notifications are dead. Both application-to-user and user-to-user. At least the way they work today. Ouch.</p>
<p>For those applications or companies that depend on these for growth this is a blow. What are notifications? They are the little lightweight messages that pop up in the Facebook user interface to let you know of some event happening in an application. They can be sent currently by applications on behalf of their users to their friends or other application users (in the case of user-to-user notifications) or from an application to its users directly (for application-to-user ones.) Facebook collects the recent ones in the bottom right of the Facebook window, as shown in the <a href="http://www.thoughtlabs.com/wp-content/uploads/2009/10/notifications.png" target="_blank">image on the left</a> (usually filled with messages from Facebook, Living Social, or <a href="http://www.zynga.com/games/index.php?game=mafiawars" target="_blank">Mafia Wars</a>.) All user-to-user notifications will be routed to the Inbox; however, there will be no way for applications to send anything on behalf of their users anymore without their consent.  Invitations/requests will also be routed &#8217;somewhere&#8217; into the Inbox. Which is fine since I cannot remember the last time time I have even looked at my requests. When they hit the 300-or-so mark I simply delete them all.  Those are all being routed to the Inbox in the near future.</p>
<p>Why kill notifications, one of the only ways left for apps to communicate with users without their consent? Simply put, they don&#8217;t work, except in very specific circumstances. Most of the time they are noise. A LOT of noise. Additionally, most people have no clue they even exist or where they live. Currently users have to keep track of <strong>five</strong> different communication channels in Facebook: invites/requests, messages (Facebook Inbox today), notifications, Feed stories (the stuff on your Wall and News Feed), and IM/Chat. They say it&#8217;s too much and no one is clear where to look for them. They&#8217;re right.</p>
<p>So basically one-to-one communications of all types Facebook wants to route to the Inbox: one spot for users to check messages targeted directly at them. Makes sense. Unclear how/if Chat will be affected if at all.</p>
<p>One-to-many communications will be handled solely by the Stream in the form of Feed stories published via the Open Stream API. And the automatically-published one-line stores that applications can publish to your Recent Activity section on your Wall? Also gone.</p>
<p>Honestly I think this is a great thing for users and for applications. Why? Because now more than ever developers and content providers are going to <strong>have</strong> to think about engagement first, before features, before copying the other guy, before writing a line of code. The only way for apps to really spread through the Stream is for users to interact with the stories that applications post there &#8211; meaning stories that application users *allow* them to post to begin with &#8211; either via the <a href="http://blog.facebook.com/blog.php?post=53024537130" target="_blank">Like</a> or Comment features.</p>
<p>The other big news on the communcation front is that Facebook will provide a means for developers to <strong>prompt their users for, and grant the right to store users&#8217; real e-mail addresses</strong>. Also the right to store their first and last names most likely, though at the time of this post the details have not been hashed out. You heard that right. Facebook will allow applications to contact users directly without having to use Facebook as the intermediary. This is HUGE. And a huge boon for Facebook Connect developers for sure.</p>
<p>What do you think?</p>
<p><strong>UI Changes : Dashboards, Counters, and the Death of the Profile Box<br />
</strong></p>
<p>Facebook is changing the look and feel of the Home Page, at least. A long, narrow bar will contain entries very similar to the way the Facebook Application menu looks today. The screen shot to the right, though blurry, gives you the idea. It will contain the friend lists like it  <img style="margin-left: 15px; margin-right: 5px; float: right;" src="http://www.thoughtlabs.com/wp-content/uploads/2009/10/ui1.jpg" alt="Facebook UI Updates" width="279" height="228" />does today but will also incorporate Bookmarks. And they&#8217;re finally giving developers an FBML &lt;fb:bookmark/&gt; tag so they don&#8217;t have to jump through hoops to get users to do so. Finally. They are also introducing UI menus they call &#8216;Dashboards&#8217; that originally will be of two types: Applications and Games. Recommendations might make the cut as well. These are all in early mock-up stages but will potentially be easier ways for users to find new apps and games. There are no distinctions at this time between them.</p>
<p>To allow users to see when applications have notified them of something they need to act on &#8211; the way notifications do today &#8211; Facebook is introducing Counters to the right of bookmarked (only?) applications in this new UI bar. You can see them in the image to the right. Counters show the number of things &#8216;you need to deal with&#8217; in the item their associated with. Presumably this would be user-to-user or application-to-user messages in the Inbox, for example.</p>
<p>The Facebook chrome is going to change (again) as well &#8211; new top nav, cleaner layout.</p>
<p>And oh the poor Boxes tab is finally meeting its maker. As developers we called it &#8216;Siberia&#8217;. If an app had a presence there its engagement was dismal, so this should be of no big surprise to anyone. One other interesting change is the change to profile or application tabs &#8211; they are going to be given much less real estate width-wise. I assume this is to compensate for the new left nav idiom? Anwyay they are going from 760-&gt;560 pixels in width.</p>
<p>Ethan hinted at some other (seemingly very significant) changes to the Profile page as well. They want to allow more sharing of content that makes your Profile more unique. That&#8217;s great &#8211; right now everyone&#8217;s looks identical except for the profile pic and potentially the one application profile box below the friends widget. They could not elaborate on these changes but suggested that they would involve some work for developers.</p>
<p><strong>Platform Policies and Programs</strong></p>
<p>Highlights here included an entirely new Facebook Developer site with completely rewritten Platform documentation, more social features focused on community. That&#8217;s great: the existing wiki is weak at best, pathetic at worst. Many of the most important pages became woefully outdated yet were locked from public editing (&lt;cough&gt;FBJS&lt;/cough&gt;). They will be providing comprehensive how-to guides and walkthroughs and will also provide all the content they covered in the demo today. One other interesting thing is that they will be providing a &#8216;Health of the Platform&#8217; section that will show how all (?!) the APIs are currently working in the wild and the current top bugs they are working on fixing, and those they expect you to work around. This will undoubtedly lessen the massive forum threads that alternate between &#8216;it works&#8217; and &#8216;it doesn&#8217;t&#8217; posts.</p>
<p>The gargantuan 14-page opus that comprises the Facebook Platform policies have been shrunk to <strong>3. </strong>With screenshots showing best practices and examples of flagrant violations of policy. Fantastic!</p>
<p>Application and Page Insights will be updated and accessible through APIs. Darn, just about finished the app to scrape them dynamically.</p>
<p><strong>Open Graph API</strong></p>
<p>This is the next evolution of Facebook Connect it sounds like. Basically it was pitched as a way for &#8216;any web page&#8217; to become a Facebook Fan Page/Public Profile through the use of what I assume are custom widgets or code in the Facebook Connect or Facebook JavaScript Client Libraries.</p>
<p>For example, let&#8217;s say as a brand I don&#8217;t want a Facebook Page. I&#8217;ve spent a lot of time cultivating an audience on an external site that I control and don&#8217;t want to fragment them by investing in a Facebook presence as well. The Open Graph API will allow me to add Facebook widgets and access their entire API allowing my users to become Fans of my EXTERNAL page &#8211; and have that show up on their Profiles WITHIN Facebook. These external pages will also show up in Facebook Search from within Facebook, just like they were Pages within the site. Developers will be able to publish Streams targeted directly at these Fans on the external site(s) that use the API. This will undoubtedly be an interesting area of development in the coming months. Along with direct email communication this will probably jolt Facebook Connect implementations into the stratosphere.</p>
<p><strong>Questions Asked By the Audience</strong></p>
<p>Some of these were very good so I&#8217;ve included them to the best of my knowledge:</p>
<p>Q: As part of it&#8217;s new interactive developer site is Facebook going to give developers a &#8216;vote&#8217; on features for Facebook to add?</p>
<p>A: Um, no.</p>
<p>Q: What&#8217;s up with Facebook&#8217;s currency system? Any news?</p>
<p>A: Facebook credits (used in past to purchase Facebook Gifts) are still in use, but they have no &#8216;real&#8217; announcements. They are testing whether or not to allow developers to use or accept them as currency in their apps but that&#8217;s about it for now.</p>
<p>Q: How are apps going to prompt for user email addresses? Extended permissions are painful today.</p>
<p>A: They know, they are going to collapse them into a fewer number of them that allow users and developers a more clear view of how they work and what they grant.</p>
<p>Q: Will counters only show up for bookmarked applications?</p>
<p>A: Yes</p>
<p>Q: Will &#8216;Publish to a Friend&#8217;s Wall&#8217; still work?</p>
<p>A: Not been addressed; only changes they&#8217;ve made to the Stream have been the Open Stream API and that&#8217;s just been a week ago &#8211; no changes planned.</p>
<p>Q: Is Facebook killing the verified applications program altogether?</p>
<p>A: Yes! They are going to spend a lot of time and expense making sure ALL applications are up to the same level of quality as verified ones were.</p>
<p>Q: Any idea in the new Stream of which messages will get more visibility or prioritization (popularity?)</p>
<p>A: Likes and Comments are key &#8211; make sure that people want to Comment and Like them. This will ensure their spread. He was unsure of how this affects search rankings within Facebook search.</p>
<p>That&#8217;s about it, in a nutshell.</p>
<p>Thoughts? Questions?</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=508&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2009/10/28/facebooks-next-steps-facebooks-roadmap-for-2009/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First Chapters of Our Book &#8216;Facebook Development: A Complete Guide to Smart Application Development for the Facebook Platform&#8217; Now Available!</title>
		<link>http://www.thoughtlabs.com/2009/06/16/first-chapters-of-our-book-facebook-development-a-complete-guide-to-smart-application-development-for-the-facebook-platform-now-available/</link>
		<comments>http://www.thoughtlabs.com/2009/06/16/first-chapters-of-our-book-facebook-development-a-complete-guide-to-smart-application-development-for-the-facebook-platform-now-available/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 20:09:09 +0000</pubDate>
		<dc:creator>Thought Labs</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ROI]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Facebook Applications]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/?p=384</guid>
		<description><![CDATA[
Our publisher,  Addison-Wesley Professional, has graciously published &#8216;Rough Cuts&#8217; -  that means they still need final edits &#8211; of the first five chapters of our upcoming book, Facebook Development: A Complete Guide to Smart Application Development for the Facebook Platform, on InformIT&#8217;s Safari Books Online. Rough Cuts allow readers to get access to the book [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.thoughtlabs.com/2009/06/16/first-chapters-of-our-book-facebook-development-a-complete-guide-to-smart-application-development-for-the-facebook-platform-now-available/" title="Permanent link to First Chapters of Our Book &#8216;Facebook Development: A Complete Guide to Smart Application Development for the Facebook Platform&#8217; Now Available!"><img class="post_image alignleft" src="http://www.thoughtlabs.com/wp-content/uploads/2009/06/Facebook-Development.png" width="160" height="206" alt="Post image for First Chapters of Our Book &#8216;Facebook Development: A Complete Guide to Smart Application Development for the Facebook Platform&#8217; Now Available!" /></a>
</p><p>Our publisher, <a title="Thought Labs and Addison-Wesley Professional" href="http://www.informit.com/imprint/index.aspx?st=61085" target="_blank"> Addison-Wesley Professional</a>, has graciously published &#8216;Rough Cuts&#8217; -  that means they still need final edits &#8211; of the first five chapters of our upcoming book, <a title="Thought Labs - Smart Application Development for Facebook" href="http://www.informit.com/store/product.aspx?isbn=0321638166" target="_blank"><span style="text-decoration: underline;"><strong>Facebook Development: A Complete Guide to Smart Application Development for the Facebook Platform</strong></span></a>, on <a title="Thought Labs Safari Books Online" href="http://my.safaribooksonline.com/9780321638175" target="_blank">InformIT&#8217;s Safari Books Online</a>. Rough Cuts allow readers to get access to the book before it&#8217;s published or purchase advance copies.</p>
<p>Here&#8217;s an excerpt:</p>
<p class="wp-caption" style="text-align: left;"><em>Currently Facebook has over  250 million active users and offers well beyond 52,000 applications &#8212; and the rate at which new applications are launching is staggering. But there is a lack of up-to-date information about developing those applications effectively &#8212; particularly in the light of platform  modifications that have rendered many applications obsolete. This book provides instruction on using the latest Facebook platform features and  helps developers create and deploy successful Facebook apps, revealing what makes them successful, how to measure progress, and how to deploy changes that will maximize the application’s value&#8230;</em></p>
<p><a href="http://my.safaribooksonline.com/9780321638175/ch01" target="_blank">Please give it a read</a> and let us know if you have any thoughts, questions, or ideas about the book or the chapters.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=384&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2009/06/16/first-chapters-of-our-book-facebook-development-a-complete-guide-to-smart-application-development-for-the-facebook-platform-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook Enables Quick Transitions to Speed Application Load Times</title>
		<link>http://www.thoughtlabs.com/2009/04/15/facebook-enables-quick-transitions-to-speed-application-load-times/</link>
		<comments>http://www.thoughtlabs.com/2009/04/15/facebook-enables-quick-transitions-to-speed-application-load-times/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 21:53:48 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Doorbell]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Facebook Applications]]></category>
		<category><![CDATA[Facebook Platform]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=220</guid>
		<description><![CDATA[Facebook today announced Quick Transitions, an Ajax-backed technology for enabling faster canvas page loads in Facebook Applications. Does it work? Not at the moment.]]></description>
			<content:encoded><![CDATA[<p></p><p><strong>Quick Transitions</strong></p>
<p><a href="http://developers.facebook.com/news.php?blog=1&amp;story=222" target="_blank">Today Facebook launched a beta feature it calls ‘Quick Transitions.’</a> This feature supposedly results in faster load times for Facebook Platform Application canvas pages. It somehow uses Ajax to load them which keeps the browser from having to do a full page refresh to render the Facebook UI elements that surround every canvas page (like the Chat and Application menu, navigation bar, and ads, etc.)</p>
<p>I wanted to see what effect, if any, enabling this feature had on one of our popular Facebook applications, <a href="http://apps.facebook.com/mydoorbell/" target="_blank">Doorbell</a>. Since this application has over 300k active users a free speed boost sounded just fine with me!</p>
<p>First, to enable the feature go to the Application Settings for your app and click on the Canvas tab. You’ll see a set of two radio buttons at the bottom of the page labeled ‘Quick Transitions.’ Click the ‘On’ button. That’s it. If your application is iframe-based you have to also edit the URLs that govern page transitions. Here&#8217;s a shot showing where to turn it on:</p>
<div id="attachment_230" class="wp-caption alignleft" style="width: 558px">
	<img class="size-full wp-image-230" title="Enabling Quick Transitions for a Facebook Application" src="http://www.thoughtlabs.com/blogs/wp-content/uploads/2009/04/qt12.png" alt="Enabling Quick Transitions for a Facebook Application" width="558" height="392" />
	<p class="wp-caption-text">Enabling Quick Transitions for a Facebook Application</p>
</div>
<p><strong>Yes, But Does it Work?</strong></p>
<p>In a word, no, at least not for me. Could it be the code? Perhaps. We use Facebook&#8217;s tab control to navigate between the canvas pages in our application currently. This could be the issue.</p>
<p>Server access logs show that the correct pages are being loaded;  however, the tab for the page never changes nor does its content load. The browser (Firefox, latest) simply sits there with an hourglass. It&#8217;s still responsive, but the canvas page content never shows. Noticed that Facebook passed along a few new GET variables as well, but they also appear to be modifying the URL for each tab&#8217;s link.</p>
<p>For example, here&#8217;s the link to our rankings page:</p>
<p><span style="font-family: courier new,courier;">http://apps.facebook.com/myapp/?page=rankings&amp;_fb_fromhash=xxxxx</span></p>
<p>The link changes after quick transitions are enabled. Here&#8217;s what my server&#8217;s access log shows (and it&#8217;s serving the content up perfectly: I get a 200/OK status code for it):</p>
<p><span style="font-family: courier new,courier;">myapp/#/myapp/?page=rankings&amp;_fb_fromhash=xxxxx&amp;quickling[version]=xxxxx%3B0&amp;nectar_impid=xxxxxx&amp;nctrct=xxxxx</span></p>
<p>&#8230;and here&#8217;s the link that shows up in the browser&#8217;s address bar:</p>
<p><span style="font-family: courier new,courier;">http://apps.facebook.com/myapp/#/myapp?page=rankings&amp;_fb_fromhash=xxxxx&amp;_fb_q=1&amp;_fb_qsub=apps.facebook.com</span></p>
<p>I&#8217;d like to get this working to test how big a speed improvement you can expect to see on your canvas page loads. I know the feature is in beta so I&#8217;ll keep this post updated with my findings as I get them&#8230;</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=220&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2009/04/15/facebook-enables-quick-transitions-to-speed-application-load-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing With New Facebook Fan Pages, Part One: Getting Page Status</title>
		<link>http://www.thoughtlabs.com/2009/03/28/dealing-with-new-facebook-fan-pages-part-one-page-getting-page-status/</link>
		<comments>http://www.thoughtlabs.com/2009/03/28/dealing-with-new-facebook-fan-pages-part-one-page-getting-page-status/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 18:57:26 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Facebook Pages]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=140</guid>
		<description><![CDATA[Facebook Pages have changed; they are now more like Facebook user profiles. So, how do you deal with their status messages? How do you get them from the API and what can go wrong?]]></description>
			<content:encoded><![CDATA[<p></p><p>The new (as of March 2009 &#8211; who knows what next week holds) <a href="http://www.thoughtlabs.com/blogs/2009/02/19/facebook-to-enhance-branded-pages-for-businesses/">Facebook Pages have become more like regular Facebook profiles</a>. The important thing to note for the purpose of this post is that they now have a Publisher that allows Page admins to set status messages for the page. And make no mistake  &#8211; these are status updates just like you would set on your own personal profiles. Why is this important? First, it allows you to handle Pages as just another source for status messages, secondly, it integrates Pages more fully into the Facebook Feed model, and finally it&#8217;s important to realize that it has created problems for some (<a href="http://forum.developers.facebook.com/viewtopic.php?id=30369">see this</a> for example.) Now that Pages are part of News Feed any status updates or posts made by a Page or will show up in your personal Feed. Obviously it makes sense to syndicate these status messages in as many ways as possible. But, the question is, <em>how</em>? </p>
<p>This post, first of a series on Facebook Pages, will begin the discussion by first talking about how you can get a Page&#8217;s status from the API.</p>
<p><strong>How do you get the status for a Page via the API?</strong></p>
<p>You can get the Page&#8217;s status by using one of the same API methods you do to get a normal user&#8217;s status &#8211; you just use the PageID as the UserID parameter in the call. <strong>You will need a valid Facebook Session key to do this</strong>, however! I&#8217;ll discuss what that means in my next post. Just remember that a Page cannot login to Facebook to get its own session key. To get that PageID you either snag it from Facebook&#8217;s POST variables (&#8217;<code>fb_sig_page_id</code>&#8216;) that are sent to a Page app&#8217;s canvas page or copy it from the Page&#8217;s URL (if you are going to be using it in places that may not have access to the POST variable or need to store it.) </p>
<p>Here&#8217;s an overview of three ways of getting a Page&#8217;s status:</p>
<table class="aligncenter" cellpadding="3">
<caption class="aligncenter"><strong>Facebook Page Status: 3 Approaches</strong></caption>
<thead>
<tr>
<th>API (PHP)</th>
<th>Notes</th>
<th>Requires Session Key</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
<tr>
<td><a href="http://wiki.developers.facebook.com/index.php/Users.getInfo">users_getInfo</a></td>
<td>returns text and time of last status message</td>
<td>yes</td>
</tr>
<tr>
<td><a href="http://wiki.developers.facebook.com/index.php/Status.get">status_get</a></td>
<td>Not present in most Facebook PHP Client libraries, use raw API call instead. Allows you to return a number of statuses at once using <code>limit</code> parameter.</td>
<td>yes</td>
</tr>
<tr>
<td><a href="http://wiki.developers.facebook.com/index.php/Status_(FQL)">fql_query</a></td>
<td>Excellent way to fetch only what parts of the status you need while making Facebook do the filtering on their end for you. Can minimize traffic to your servers; however, FQL can be slow.</td>
<td>yes</td>
</tr>
</tbody>
</table>
<p>So which way is &#8216;best&#8217;?</p>
<p>It depends on what you need out of the status itself. For example, the first method above, using users_getInfo, only allows you to get the LAST status message for a given Page (or user.) For example it returns the following (PHP):</p>
<pre>
Array
(
    [0] => Array
        (
            [uid] => 714497440
            [status] => Array
                (
                    [message] => is writing a blog post about Facebook Fan Pages
                    [time] => 1237687152
                    [status_id] => 7066343802
                )
        )
)
</pre>
<p>The second method, status_get, returns more information about each status message. Additionally, it lets you return more than one.<br />
For example, either of these would return the last 2 status messages for user <a href="http://www.facebook.com/home.php?#/profile.php?id=714497440&#038;ref=profile">714497440</a></p>
<pre>
$facebook->api_client->status_get('714497440','2');
$facebook->api_client->call_method("facebook.status.get",
                                                   array(  'uid'=>'714497440',
                                                             'limit'=>'2')
);
</pre>
<p>The results are shown below in JSON format since the PHP client return value does not offer associative names for the data:</p>
<pre>
[
   {
      "uid":714497440,
      "status_id":70669311802,
      "time":1237687152,
      "source":6628568379,
      "message":"status message 0"
   },

   {
      "uid":714497440,
      "status_id":70669311802,
      "time":1237687152,
      "source":0,
      "message":"status message 1"
   }
]
</pre>
<p>Finally, using FQL allows you to filter down to only the relevant bit of information you need. For example, if you just want the ids of the last 5 statuses messages for a Page you can simply use this FQL query:</p>
<pre>SELECT status_id FROM status WHERE uid = $pageID LIMIT 5</pre>
<p>The beauty of the final approach is that it not only allows you to minimize the size of the return data from Facebook but it also can be used as part of the FQL preloading process that performs FQL queries before calling your canvas page. You still take the hit for the FQL call, but it save a round trip, and additionally removes the automatic sending of the currently-logged in user&#8217;s entire friend list as part of the Facebook POST variables sent to your page! This can cut down on traffic if your app users have large numbers of friends. Since the average friend count on Facebook now stands at 120 this could be significant for long-term bandwidth costs. NOTE: the status_get API call basically returns the same result as this FQL query:</p>
<pre>
SELECT * FROM status where uid = $pageID ...
</pre>
<p>Hopefully this gives you some insight into the basic involved with getting a Facebook Page&#8217;s status. In the next post I&#8217;ll talk about how you handle this because Facebook requires a valid session key from a logged-in user to call any of these APIs. This can cause problems, for example, when you have code that runs without user interaction (via a cron job to update a Page profile tab for example.)</p>
<p>Stay tuned&#8230;</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=140&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2009/03/28/dealing-with-new-facebook-fan-pages-part-one-page-getting-page-status/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting up Flash CS4 to log trace messages to a file</title>
		<link>http://www.thoughtlabs.com/2008/12/09/setting-up-flash-cs4-to-log-trace-messages-to-a-file/</link>
		<comments>http://www.thoughtlabs.com/2008/12/09/setting-up-flash-cs4-to-log-trace-messages-to-a-file/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 20:21:59 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=112</guid>
		<description><![CDATA[This is a very handy feature, especially if you have to write your code in Actionscript 2 for which the Flash CS4 debugger is terrible, terrible, terrible. Trace messages are great but when your Flash .swf is running in a browser, and needs to (for instance if it is running on a Facebook application and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This is a very handy feature, especially if you have to write your code in Actionscript 2 for which the Flash CS4 debugger is terrible, terrible, terrible. Trace messages are great but when your Flash .swf is running in a browser, and needs to (for instance if it is running on a Facebook application and needs to interact with Facebook real-time) but without using a tool &#8211; there are a few &#8211; or a custom Flash listener how can you see your trace messages?</p>
<p>Here&#8217;s how to log them to a file. Note that these instructions are different <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19323" target="_blank">from what Adobe recommended for Flash CS3/ Flash Player 9</a>. They have changed the rules a bit. Here&#8217;s how to get this working for Adobe Flash CS4 and the latest Flash Player (version 10.0.12.36 as of this post date.)</p>
<p><strong>Uninstall your current Flash players</strong></p>
<p>Go <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157&amp;sliceId=1" target="_blank">here</a> and get Adobe&#8217;s Flash Player uninstaller. Do not try to uninstall your Flash players any other way unless you know exactly what you are doing. You will just screw things up. Close your browsers and run the uninstaller you downloaded.</p>
<p><strong>Download and install the latest Debug Flash Players</strong></p>
<p>Go <a href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">here</a> to get them. Close all of your browser windows first, then install the plugin version (for FF and plugin-based browsers) and the the ActiveX version for IE. This assumes you are running Windows. Follow instructions in previous link if you are running OSX or Linux.</p>
<p><strong>Create the mm.cfg file</strong></p>
<p>Again, this assumes you are running Windows. Open Explorer and go to the C:\Documents and Settings\[your username] directory. If you don&#8217;t have this directory check what your HOMEPATH environment variable is set to and browse to that directory instead. Create a text file in this directory named mm.cfg. Paste the following 2 lines of text into the file:</p>
<pre>ErrorReportingEnable=1
TraceOutputFileEnable=1</pre>
<p>Save the file.</p>
<p>The first line allows the Flash Debug player to write error and warning messages to the file, the second writes trace messages.</p>
<p><strong>Create the flashlog.txt file</strong></p>
<p>Well, let Flash do it for you.</p>
<ul>
<li> If you have Flash installed:</li>
</ul>
<p>Go to wherever you installed Flash (usually C:\Program Files\Adobe\Flash CS4) and open the Players\Debug directory. Run the FlashPlayer.exe file. That&#8217;s it.</p>
<ul>
<li>If you don&#8217;t have Flash installed:</li>
</ul>
<p>Run the flashplayer_10_sa_debug.exe file you downloaded above. Again, that&#8217;s it.</p>
<p>This step is required because the Debug Standalone Player is what initially creates the flashlog.txt file where all of your trace() messages will end up. To verify that it&#8217;s been created, look for it (in Windows) in C:\Documents and Settings\[username]\Application Data\Macromedia\Flash Player\Logs or the equivalent if you have some different install scheme.</p>
<p><strong>Load your Flash file in a browser</strong></p>
<p>You should see your trace messages output in all their glory in your flashlog.txt file. Ensure that you don&#8217;t have trace messages being stripped from your Flash file in your Publish Settings!</p>
<p><strong>Notes and Gotchas</strong></p>
<ul>
<li>By default ALL trace, warning, and error messages from ALL running Flash files in the current browser session are written to this file. It&#8217;s best, therefore to preface all of your trace messages with some tag or indicator that they are yours, and from a specific application. I usually use a constant that I preface all of my trace messages with for easy identification.</li>
<li>Warnings and errors are very common in the file, you may want to set ErrorReportingEnable=0 in the mm.cfg file if you are just interested in trace messages.</li>
<li>DO NOT RUN ANY ADOBE AIR APPLICATIONS WHILE YOU ARE TRYING TO GENERATE TRACE OUTPUT! This one nearly drove me mad! The Flash Debug Player WILL NOT write flashlog.txt file if an Air file is running so you won&#8217;t see any of your trace messages. Air files lock the flashlog.txt file when they run, effectively disabling all tracing. So, no matter how much you cannot live without it, make sure <a href="http://www.tweetdeck.com" target="_blank">TweetDeck</a> is not running (<a href="http://www.twitter.com" target="_blank">Twitter</a> will wait, believe me) or you won&#8217;t see squat. =)</li>
<li>If you want to monitor the file real-time without having to keep it open in an editor you can use <a href="http://www.cygwin.com/" target="_blank">cygwin</a>&#8217;s TAIL command to follow the file in a console window. First, install cygwin, then open a console window (Start | Run | cmd.exe) and type:</li>
</ul>
<pre>          tail /F /N50 [your path to flashlog.txt]</pre>
<p>The console window will scroll and fill with your trace messages as they happen. If you use <a href="http://www.aptana.com/" target="_blank">Aptana</a> for web development its <a href="http://www.aptana.com/docs/index.php/Displaying_the_TailView_View" target="_blank">TailView feature</a> is really handy for this as well. If you don&#8217;t want to install cygwin or don&#8217;t have Aptana installed <a href="http://www.spugbrap.com/blog/2007/05/how-to-tail-files-in-windows/" target="_blank">this post</a> describes how to get the same effect.</p>
<p>I found flashlog.txt to be a lifesaver. If anyone has any questions, just let me know.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=112&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/12/09/setting-up-flash-cs4-to-log-trace-messages-to-a-file/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Cappy Popp&#8217;s Slides from GSP East: &#8216;Migrating from Facebook to Bebo&#8217;</title>
		<link>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/</link>
		<comments>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 20:28:42 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Strategy]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=64</guid>
		<description><![CDATA[Here are my slides from my presentation this morning at GSP East. Please let me know if you have any questions.
You can also get them on slideshare here.
]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.thoughtlabs.com/blogs/wp-content/uploads/2008/06/migrating-from-facebook-to-bebo.ppt">Here are my slides from my presentation this morning at GSP East</a>. Please let me know if you have any questions.</p>
<p>You can also get them on <a href="http://www.slideshare.net/hiscapness/migrating-from-facebook-to-bebo/" target="_blank">slideshare here</a>.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=64&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>John Maver&#8217;s slides from GSP East &#8211; Introduction to Bebo Development Workshop</title>
		<link>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/</link>
		<comments>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 17:48:52 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=62</guid>
		<description><![CDATA[Here is my slide deck from GSP East workshop on creating a Bebo Application.
Link to Slideshare.com. The notes for each slide contain additional information useful in building your first application.
Post any questions below or on the Bebo Forums.
]]></description>
			<content:encoded><![CDATA[<p></p><p>Here is my slide deck from GSP East workshop on creating a Bebo Application.<br />
<a href='http://www.slideshare.net/jmaver/intro-to-bebo-applications/'>Link to Slideshare.com</a>. The notes for each slide contain additional information useful in building your first application.<br />
Post any questions below or on the Bebo Forums.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=62&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Bebo application using PHP 5</title>
		<link>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/</link>
		<comments>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/#comments</comments>
		<pubDate>Fri, 09 May 2008 02:49:11 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=43</guid>
		<description><![CDATA[A tutorial in how to build a Bebo Application using PHP. Shows how to build a canvas page, profile box, generate news stories, and allow invites.]]></description>
			<content:encoded><![CDATA[<p></p><h2>Introduction</h2>
<p>I have been answering a lot of email requests for how to get started with a Bebo application. Since applications can be written in any language that supports interaction with the Bebo REST API, developers have a lot of choices in how they build their application. The focus of this article will be on the &#8220;officially supported language&#8221; &#8211; PHP. I saw officially supported, because the Bebo Platform Team has released a simple PHP wrapper that makes using the REST API very simple, and they update this from time to time.</p>
<p>Before creating an application, you need to understand the parts of an application and how they interact with Bebo. I will go over each part below, and then show an example of a very simple application that uses each part.</p>
<h2>The parts of a Bebo Application</h2>
<p><strong>The Bebo URL</strong> &#8211; this is the URL that users go to on Bebo. It is in the format &#8220;<strong><em>http://apps.bebo.com/yourapp/</em></strong>&#8221;</p>
<p><strong>The Callback URL </strong>- this is the URL on your server that Bebo redirects to. It is where the actual application lives.</p>
<p><strong>The Canvas Page</strong> &#8211; this is the main page of a Bebo application. It takes up the entire web page, except for the Bebo top header and footer. User&#8217;s going to your canvas page are using your server directly via the callback URL. Canvas pages can either be written in SNML, a markup language that is standardized across Facebook and Bebo and is fast to load, or in an iFrame. Javascript is only allowed in iFrame based applications, but they cannot use SNML.</p>
<p><strong>The Profile Box</strong> &#8211; each application can create a presence on the installing user&#8217;s Profile page. This contents of this box are set by the application, but when the user is seeing this Profile box, it is running a cached version on Bebo&#8217;s servers. The user can click links or interact with Flash to go to the canvas page or call back to your server using simple AJAX. Since browsing other people&#8217;s Profiles is one of the main activities on Bebo, creating a compelling Profile Box is a very important part of helping your application to spread.</p>
<p><strong>Invitations</strong> &#8211; each application can provide a way for users to recommend it to their friends. Bebo provides a common dialog for selecting friends, and limits the total number of invitations that can be send per person per day. You can control some of the text that the inviter sees when selecting their friends, and some of the text in the actual invitation. Your application must give the user a reason to want to send an invitation, either by being innately good, or by some type of reward system for invited friends.</p>
<p><strong>News Stories</strong> &#8211; applications can produce news stories based on how the users interact with the application. These stories appear on the user&#8217;s Profile page in the news section. Bebo will also show the most interesting stories from a user&#8217;s friends on their home page. News stories should be interesting and actionable in order to help your application spread and provide value to the user.</p>
<h2>Building a Bebo Application</h2>
<ol>
<li><strong>Get a Server</strong> &#8211; As I said above, we will focus on building an application using PHP. The first thing you need is a server to host your application files. Some likely candidates might be your home pc to start, Joyent or another hosting company, or the Amazon EC2 web server platform. As your application grows, your server needs will probably grow as well, so it good to think about how you will handle thousands of users early on. RightScale.com provides some automatic scaling services on top of the Amazon EC2 platform, that let you spin up and shut down servers to meet your demand, so that you only pay for what you use. You will need the information about this server to set up and deploy your application.</li>
<li><strong>Install the Bebo Developer Application</strong> &#8211; go to <a href="http://www.bebo.com/Profile.jsp?MemberId=5036051566">http://www.bebo.com/Profile.jsp?MemberId=5036051566</a> and install this application. It is written by Bebo, and is required to let you set up your application with Bebo. Once you have it installed, you can go to create a new application.
<ol>
<li>Click the Create New Application link at the top right</li>
<li>Enter the Application Name &#8211; this is the name you want people to see. Example: &#8220;Favorite Birds&#8221;.</li>
<li>Enter the Application URL &#8211; this is the Bebo URL that users will go to. This name doesn&#8217;t have to match the Application Name, and in some cases cannot, because the name you pick might already be in use. Example: &#8220;favoritebirds&#8221;.</li>
<li>Pick a canvas style &#8211; If you want to use the Bebo SNML markup language, choose SNML. If you want to host an external site in an iframe or use javascript frameworks, then choose iFrame. For this example, we will choose SNML.</li>
<li>Enter a description &#8211; Type something, but don&#8217;t worry too much about this now, you can fill this out later.</li>
<li>Enable on a profile &#8211; Check this box if you want to let users have your application on their profile. In almost every case, you will leave this checked.</li>
<li>Callback URL &#8211; the location on your server that holds your files. I like to have the directory match the application url I set above, and I end it in a slash. Example: <strong><em>http://myserver.com/favoritebirds/</em></strong></li>
<li>Post Add URL &#8211; Leave this blank for now. I will go over how to handle this later.</li>
<li>Remove Callback URL -Leave this blank for now. I will go over how to handle this later.</li>
<li>Default SNML &#8211; this is a way to initially set the contents of all new user&#8217;s profile boxes.</li>
<li>Categories &#8211; pick one that fits your application. You can change it later.</li>
<li>Icons &#8211; you can update this later, so leave it for now.</li>
<li>Leave the Manage Test Group checkbox checked and set to Only Developers.</li>
<li>Check the I have read the terms checkbox.</li>
<li>Click Create Application.</li>
<li>It should take you to the My Applications page and you should see your new application along with a bunch of other information. We will use this later, so leave the page up.</li>
</ol>
</li>
<li><strong>Get the Bebo library</strong> &#8211; the Bebo platform team provides an updated wrapper library here <a href="http://developer.bebo.com/downloads/example-libs-php.php">http://developer.bebo.com/downloads/example-libs-php.php</a>.
<ol>
<li>Create a new source directory &#8211; c:\src\favoritebirds.</li>
<li>Download this file and save it in your source directory.  Call it something simple, like bebo.php.</li>
</ol>
</li>
<li><strong>Set up your web host</strong>
<ol>
<li>In Apache, edit your http.conf or create an .htaccess file so that your new callback url <strong><em>http://myserver.com/favoritebirds/</em></strong> points to your source directory.</li>
<li>In IIS, use the IISAdmin tool to create a new Virtual Directory so that your new callback url <strong><em>http://myserver.com/favoritebirds/</em></strong> points to your source directory.</li>
</ol>
</li>
<li><strong>Create your index.php file</strong>
<ol>
<li>For this example, we will do all the work in this file. In a real application, you would want to split up your work into classes or modules or include files that make sense for your project.</li>
<li>Include the bebo php library.
<pre class="php">    <span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">&quot;bebo.php&quot;</span>;</pre>
</li>
<li>Your file needs to have some globals that define the project.
<pre class="php">    <span style="color: #0000ff;">$appVisibleName</span> = <span style="color: #ff0000;">&quot;Example App&quot;</span>;
    <span style="color: #0000ff;">$appApiKey</span> = <span style="color: #ff0000;">'copy API Key from the developer application page'</span>;
    <span style="color: #0000ff;">$appSecret</span> = <span style="color: #ff0000;">'copy API Secret from the developer application page'</span>;
    <span style="color: #0000ff;">$appCallback</span> = <span style="color: #ff0000;">'put in your callback url. Ex - http://myserver.com/favoritebirds/ '</span>;
    <span style="color: #0000ff;">$appBeboURL</span> = <span style="color: #ff0000;">'put in the Application URL above - http://apps.bebo.com/favoritebirds/'</span>;</pre>
</li>
<li>The easiest way to handle users is to force everyone to add right away. If they haven&#8217;t Bebo will take then to the add page and then send them back. If they have already added your application, then you will just get their userid.
<pre class="php">    <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</li>
<li>Now you can display the page to them using some SNML.</li>
<pre class="php">    displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Welcome back, &lt;sn:name uid='$userID' useyou='false' /&gt;.&lt;br/&gt;
            You have a nice picture:&lt;sn:profile-pic uid='$userID' linked='false'/&gt;&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</ol>
<p>You now have a fully functional Bebo application. But, let&#8217;s add some more features.</li>
<li><strong>Updating the user&#8217;s profile</strong>
<ol>
<li>It is simple to update a user&#8217;s Profile Box each time they access your application. Just create a new updateProfile function and call it after your displayPage function.
<pre class="php">    updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$snml</span> = <span style="color: #ff0000;">&quot;This is the $appVisibleName profile box of &lt;sn:name uid='$userID' useyou='false' /&gt;
			&lt;br/&gt;&lt;sn:profile-pic uid='$userID' size='square' linked='false'/&gt;&quot;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">profile_setSNML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$snml</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
<li><strong>Creating a News Story when the user accesses your page</strong>
<ol>
<li>News stories are a great way to let a user&#8217;s friends know about the great things the user is doing with your application. Just add a new publishStory function and call it when the user does something meaningful.
<pre class="php">    publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
&nbsp;
        <span style="color: #0000ff;">$actor</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$title_template</span> = <span style="color: #ff0000;">&quot;{actor} used &lt;a href='$appBeboURL'&gt;$appVisibleName&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$title_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_template</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_general</span> = <span style="color: #ff0000;">&quot;Everyone should try $appVisibleName. &lt;a href='$appBeboURL'&gt;
			Install $appVisibleName today.&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$image1</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$image1Link</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
        try <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$result</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">feed_publishTemplatizedAction</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$actor</span>, <span style="color: #0000ff;">$title_template</span>,
			<span style="color: #0000ff;">$title_data</span>, <span style="color: #0000ff;">$body_template</span>, <span style="color: #0000ff;">$body_data</span>, <span style="color: #0000ff;">$body_general</span>,
            <span style="color: #0000ff;">$image1</span>, <span style="color: #0000ff;">$image1Link</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> catch<span style="color: #66cc66;">&#40;</span> Exception <span style="color: #0000ff;">$ex</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
<li><strong>Allow users to share your application with Invites</strong>
<ol>
<li>If your application is worthwhile, users will want to let their friends know about it. Use the standard Bebo Invite control to let them invite up to 20 friends/day. Just add a new getInvitePageURL function, and add a link somewhere on your page to that url.
<pre class="php">    <span style="color: #0000ff;">$invitePageURL</span> = getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;a href='$invitePageURL'&gt;Would you like to invite some friends?&lt;/a&gt;&quot;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appApiKey</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$beboInvitePage</span> = <span style="color: #ff0000;">&quot;http://www.bebo.com/multi_friend_selector.php&quot;</span>;
        <span style="color: #808080; font-style: italic;">// What the inviter sees</span>
        <span style="color: #0000ff;">$actionText</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Which friends do you want to invite?&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$action</span> = <span style="color: #0000ff;">$appBeboURL</span>;
        <span style="color: #0000ff;">$type</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Invite&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// What the recipient sees</span>
        <span style="color: #0000ff;">$acceptInviteButtonURL</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">get_add_url</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$acceptInviteButtonLabel</span> = <span style="color: #ff0000;">&quot;Add $appVisibleName&quot;</span>;
        <span style="color: #0000ff;">$acceptInviteButton</span> = <span style="color: #ff0000;">&quot;&lt;sn:req-choice url='$acceptInviteButtonURL' label='$acceptInviteButtonLabel' /&gt;&quot;</span>;
        <span style="color: #0000ff;">$content</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hey, try out $appVisibleName. $acceptInviteButton&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$sig</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">// update with the signature tool. This is a two step process. Generate the url for the invite page</span>
        <span style="color: #808080; font-style: italic;">// Then go to http://www.bebo.com/AppToolSig.jsp and paste it in. At the bottom, you will get a signature. Update the value above.</span>
        <span style="color: #808080; font-style: italic;">// If you change the invite text, you will have to regenerate the sig above</span>
        <span style="color: #0000ff;">$invitePageURL</span> = <span style="color: #ff0000;">&quot;$beboInvitePage?sig=$sig&amp;#038;api_key=$appApiKey&amp;#038;content=$content&amp;#038;type=$type
			&amp;#038;action=$action&amp;#038;actiontext=$actionText&amp;#038;invite=true&quot;</span>;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$invitePageURL</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
</ol>
<p><strong>Here is the completed sample:</strong></p>
<pre class="php">    &lt;!DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> <span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
    date_default_timezone_set<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;America/New_York&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">&quot;bebo.php&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Global definitions for your app</span>
    <span style="color: #0000ff;">$appVisibleName</span> = <span style="color: #ff0000;">&quot;Favorite Birds&quot;</span>;
    <span style="color: #0000ff;">$appApiKey</span> = <span style="color: #ff0000;">&quot;copy API Key from the developer application page&quot;</span>;
    <span style="color: #0000ff;">$appSecret</span> = <span style="color: #ff0000;">&quot;copy API Secret from the developer application page&quot;</span>;
    <span style="color: #0000ff;">$appCallback</span> = <span style="color: #ff0000;">&quot;http://myserver.com/favoritebirds &quot;</span>;
    <span style="color: #0000ff;">$appBeboURL</span> = <span style="color: #ff0000;">&quot;http://apps.bebo.com/favoritebirds/&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">///Main Entry Point ///</span>
    <span style="color: #808080; font-style: italic;">// Force everyone to add the application.</span>
    <span style="color: #808080; font-style: italic;">// If they have already added it, then display the page</span>
    <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Update the user's profile</span>
    updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Publish a news story</span>
    publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">///End Main Entry Point ///</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Welcome back, &lt;sn:name uid='$userID' useyou='false' /&gt;.&lt;br/&gt;
            You have a nice picture:&lt;sn:profile-pic uid='$userID' linked='false'/&gt;&quot;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// Add the link to the invite page</span>
        <span style="color: #0000ff;">$invitePageURL</span> = getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$output</span> .= <span style="color: #ff0000;">&quot;&lt;br/&gt;&lt;a href='$invitePageURL'&gt;Would you like to invite some friends?&lt;/a&gt;&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// returns the url for the Bebo standard invite page</span>
    <span style="color: #000000; font-weight: bold;">function</span> getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appApiKey</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$beboInvitePage</span> = <span style="color: #ff0000;">&quot;http://www.bebo.com/multi_friend_selector.php&quot;</span>;
        <span style="color: #808080; font-style: italic;">// What the inviter sees</span>
        <span style="color: #0000ff;">$actionText</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Which friends do you want to invite?&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$action</span> = <span style="color: #0000ff;">$appBeboURL</span>;
        <span style="color: #0000ff;">$type</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Invite&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// What the recipient sees</span>
        <span style="color: #0000ff;">$acceptInviteButtonURL</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">get_add_url</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$acceptInviteButtonLabel</span> = <span style="color: #ff0000;">&quot;Add $appVisibleName&quot;</span>;
        <span style="color: #0000ff;">$acceptInviteButton</span> = <span style="color: #ff0000;">&quot;&lt;sn:req-choice url='$acceptInviteButtonURL' label='$acceptInviteButtonLabel' /&gt;&quot;</span>;
        <span style="color: #0000ff;">$content</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hey, try out $appVisibleName. $acceptInviteButton&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$sig</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">// update with the signature tool. This is a two step process. Generate the url for the invite page</span>
        <span style="color: #808080; font-style: italic;">// Then go to http://www.bebo.com/AppToolSig.jsp and paste it in. At the bottom, you will get a signature. Update the value above.</span>
        <span style="color: #808080; font-style: italic;">// If you change the invite text, you will have to regenerate the sig above</span>
        <span style="color: #0000ff;">$invitePageURL</span> = <span style="color: #ff0000;">&quot;$beboInvitePage?sig=$sig&amp;#038;api_key=$appApiKey&amp;#038;content=$content&amp;#038;type=$type&amp;#038;action=$action&amp;#038;actiontext=$actionText&amp;#038;invite=true&quot;</span>;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$invitePageURL</span>;
    <span style="color: #66cc66;">&#125;</span>	
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$snml</span> = <span style="color: #ff0000;">&quot;This is the $appVisibleName profile box of &lt;sn:name uid='$userID' useyou='false' /&gt;
			&lt;br/&gt;&lt;sn:profile-pic uid='$userID' size='square' linked='false'/&gt;&quot;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">profile_setSNML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$snml</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
&nbsp;
        <span style="color: #0000ff;">$actor</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$title_template</span> = <span style="color: #ff0000;">&quot;{actor} used &lt;a href='$appBeboURL'&gt;$appVisibleName&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$title_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_template</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_general</span> = <span style="color: #ff0000;">&quot;Everyone should try $appVisibleName. &lt;a href='$appBeboURL'&gt;Install $appVisibleName today.&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$image1</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$image1Link</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
        try <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$result</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">feed_publishTemplatizedAction</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$actor</span>, <span style="color: #0000ff;">$title_template</span>,
			<span style="color: #0000ff;">$title_data</span>, <span style="color: #0000ff;">$body_template</span>, <span style="color: #0000ff;">$body_data</span>, <span style="color: #0000ff;">$body_general</span>,
            <span style="color: #0000ff;">$image1</span>, <span style="color: #0000ff;">$image1Link</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> catch<span style="color: #66cc66;">&#40;</span> Exception <span style="color: #0000ff;">$ex</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<h2>Advanced user state management</h2>
<p>The example above just forces everyone to add, but isn&#8217;t able to specially handle new installs or removals. You can handle those by looking at the $_REQUEST parameters that Bebo passes your application. These parameters show that users come to your application in 1 of 3 states:</p>
<ol>
<li>Just installed the application</li>
<li>A normal user of the application</li>
<li>Just removed the application</li>
</ol>
<p>By changing the block marked ///Main Entry Point /// above to one that detects the state, you can handle each one differently. You will need to add new functions to handle new user installs and uninstalls</p>
<pre class="php">    <span style="color: #808080; font-style: italic;">///Main Entry Point ///</span>
    <span style="color: #808080; font-style: italic;">// An existing user will have the fb_sig_in_canvas variable set, unless they are removing</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#41;</span> &amp;<span style="color: #808080; font-style: italic;">#038;&amp;#038; isSet($_POST['fb_sig_in_canvas'])) {    </span>
&nbsp;
        <span style="color: #808080; font-style: italic;">//  Bebo will pass their user id and that they have added the application</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> &amp;<span style="color: #808080; font-style: italic;">#038;&amp;#038; $_POST['fb_sig_added'] == 1 ) {</span>
            <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// If the user has just installed, Bebo will pass installed as a GET parameter</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#41;</span> &amp;<span style="color: #808080; font-style: italic;">#038;&amp;#038; isSet($_GET['installed']) ) {</span>
                newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// Normal users will go through here, so display the page</span>
            <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
            displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// Update the user's profile</span>
            updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// Publish a news story</span>
            publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// If you set up your own post add handler, then you must handle the add request the way you want,</span>
    <span style="color: #808080; font-style: italic;">// and then redirect back to your Bebo URL. If you don't specify a post add handler, Bebo does this for you.</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#41;</span> &amp;<span style="color: #808080; font-style: italic;">#038;&amp;#038; isSet($_GET['installed']) ) {</span>
          <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
          newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span> <span style="color: #66cc66;">&#41;</span>;
          <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">redirect</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #808080; font-style: italic;">// If you specify a post remove URL, then Bebo will call it with this POST variable.</span>
    <span style="color: #808080; font-style: italic;">// After this call, you won't get anything else from this user unless they re-add your application</span>
     <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#41;</span> &amp;<span style="color: #808080; font-style: italic;">#038;&amp;#038; isSet($_POST['fb_sig_uninstall']) ) {</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span>;
        uninstallUser<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// If the user goes to your callback URL directly, they didn't come in from Bebo, and you will have no information about the user</span>
    <span style="color: #808080; font-style: italic;">// In most cases, you will just want to force the user to add the application by using require_add. This will force them back through</span>
    <span style="color: #808080; font-style: italic;">// the existing user path above</span>
    <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// Handle a new user installation</span>
    <span style="color: #000000; font-weight: bold;">function</span> newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// We can use the SNML to say hello to the user</span>
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Hello, &lt;sn:name uid='$userID' useyou='false' /&gt;. Thanks for adding the application!&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">function</span> uninstallUser<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// You can't actually display anything to the user, or redirect them.</span>
        <span style="color: #808080; font-style: italic;">// All you can do is clean up inside your application.</span>
&nbsp;
    <span style="color: #66cc66;">&#125;</span>	
&nbsp;
    <span style="color: #808080; font-style: italic;">///End Main Entry Point ///</span></pre>
<h2>About Thought Labs</h2>
<p>Thought Labs provides custom software development and consulting services with a specialization in Social Network technologies. We build branded Facebook Pages for your company or multiple Pages for your various products. In addition, we create rich interactive applications on your Page to help users find your products and services. Thought Labs can also create custom Facebook, Bebo or OpenSocial applications carrying your message and your brand with them.</p>
<p>We pride ourselves on the quality of our work. We employ top application developers who are creative, highly skilled, up-to-date on the Social Networks&#8217; constantly changing APIs, and excellent at project management. We set high standards for ourselves and we meet them. In this new world of social marketing, Thought Labs delivers extremely innovative, high-quality work on time and on budget. Find out more at <a href="http://www.thoughtlabs.com">http://www.thoughtlabs.com.</a></p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=43&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Facebook: &lt;Fb:page-admin-edit-header/&gt; and canvas page POSTing</title>
		<link>http://www.thoughtlabs.com/2008/02/22/facebook-and-canvas-page-posting/</link>
		<comments>http://www.thoughtlabs.com/2008/02/22/facebook-and-canvas-page-posting/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 19:04:51 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/02/22/facebook-and-canvas-page-posting/</guid>
		<description><![CDATA[I came across this issue today where I was getting an error when trying to add the &#60;Fb:page-admin-edit-header/&#62; to a canvas page of a page-only app.
The app was installed on a Facebook Page of which I was an admin.
Basically I had the following situation:
[0] canvas page that had &#60;Fb:page-admin-edit-header/&#62; rendered correctly at top when the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><span>I came across this issue today where I was getting an error when trying to add the &lt;Fb:page-admin-edit-header/&gt; to a canvas page of a page-only app.<br />
The app was installed on a Facebook Page of which I was an admin.</span></p>
<p>Basically I had the following situation:</p>
<p>[0] canvas page that had &lt;Fb:page-admin-edit-header/&gt; rendered correctly at top when the canvas page was first hit</p>
<p>[1] canvas page had a simple non-Ajax form that submitted back to itself via POST</p>
<p>[2] POST url just contained URL of page</p>
<p>When I submitted the form, I kept getting the following error:<span></span></p>
<p><span>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong>Errors while loading page from application<br />
Runtime errors:</strong><br />
fb:page-admin-edit-header can only display on a fbpage application.<br />
There are still a few kinks Facebook and the makers of Accountability Journal-cp are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged &#8211; if it persists, please come back in a few days. Thanks!<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p><span>I verified that the app was indeed a &#8216;page-only&#8217; app, and that I had admin rights to the Facebook Page on which it was installed.</span></p>
<p>It seemed to me that this app was working perfectly until today, though I may be wrong about that&#8230;</p>
<p><span style="color: red">It turns out that you <strong>MUST</strong> add the &#8216;fb_page_id=[pageID]&#8216; URL param to the POST URL.</span> <span style="color: Black">Even though all of the FB variables were present in the original POST (fb_sig_page_id, fb_sig_is_admin=1, etc.) it appears that you must still provide the URL param in order for the FBML processing to insert the &lt;Fb:page-admin-edit-header/&gt; correctly.</span></p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=38&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/02/22/facebook-and-canvas-page-posting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
