<?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>Silverlight &#124; WPF &#124; Microsoft.Net &#187; PHP</title>
	<atom:link href="http://joel.neubeck.net/category/open-source/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://joel.neubeck.net</link>
	<description>Simplifing structure without changing results</description>
	<lastBuildDate>Wed, 26 May 2010 18:43:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Facebook Developers Garage Presentation</title>
		<link>http://joel.neubeck.net/2007/11/fdg-phx-presentation/</link>
		<comments>http://joel.neubeck.net/2007/11/fdg-phx-presentation/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 22:00:40 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Terralever]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2007/11/fdg-phx-presentation/</guid>
		<description><![CDATA[On November 14th @ the Tempe Center for the Arts Terralever hosted Phoenix’s first Facebook Developer’s Garage. The event was a great success.  I especially enjoyed the presentations by Chris Johnson  of Terralever and Dave Morin of Facebook. I encourage everyone to look at Chris slides on marketing a Facebook application. For those of you who might be interested [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox[pics-1195942360]" href="http://joel.neubeck.net/wp-content/uploads/2007/10/fb_garage.jpg" title="Facebook - Developers Garage - Phoenix"><img width="125" src="http://joel.neubeck.net/wp-content/uploads/2007/10/fb_garage.thumbnail.jpg" alt="Facebook - Developers Garage - Phoenix" height="200" class="imageframe imgalignleft" /></a><span style="color: #333333; font-family: 'Trebuchet MS','sans-serif'" lang="EN">On November 14th @ the Tempe Center for the Arts Terralever hosted Phoenix’s first Facebook Developer’s Garage. The event was a great success.  I especially enjoyed the presentations by <a href="http://www.facebook.com/profile.php?id=515434240"><font color="#0000ff">Chris Johnson</font></a>  of Terralever and <a href="http://www.facebook.com/profile.php?id=10200882"><font color="#0000ff">Dave Morin</font></a> of Facebook. I encourage everyone to look at Chris slides on marketing a Facebook application. For those of you who might be interested in what I spoke about take a look at my 15 min presentation on the “Anatomy of a Facebook App”  With so little time,  I was unable to jump to deep into the platform, but managed to get through the basic steps to create a your first Facebook Application.<o:p></o:p></span></p>
<p style="line-height: 19.2pt"><span style="color: #333333; font-family: 'Trebuchet MS','sans-serif'" lang="EN">Download: <a target="_blank" href="http://joel.neubeck.net/wp-content/uploads/2007/11/fdgphx_joel_neubeck.ppt"><font color="#0000ff">Anatomy of a Facebook Application</font></a><br />
Date: November 14, 2007<br />
Location: Tempe Center for the Arts</span></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2007/11/fdg-phx-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook &#8211; fbml_refreshImgSrc</title>
		<link>http://joel.neubeck.net/2007/10/facebook-fbml_refreshimgsrc/</link>
		<comments>http://joel.neubeck.net/2007/10/facebook-fbml_refreshimgsrc/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 21:08:39 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbml_refreshImgSrc]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2007/10/facebook-fbml_refreshimgsrc/</guid>
		<description><![CDATA[Maybe its just a temporary thing, but lately the Facebook server has had major issues with caching images.  If you are unaware, all images that are placed within a users profile page get scraped by Facebook and served up from their own internal servers.  If for some unforeseen reason there scraper fails your image gets replaced with [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe its just a temporary thing, but lately the Facebook server has had major issues with caching images.  If you are unaware, all images that are placed within a users profile page get scraped by Facebook and served up from their own internal servers.  If for some unforeseen reason there scraper fails your image gets replaced with an invisible pixel spacer gif.  To force the cache to update you have to manually call the <strong>fbml_refreshImgSrc</strong> method on their REST server.  The easiest way to accomplish this is to create a dedicated page that uses an infinite session.  Here is the PHP page I created to update the images as necessary.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$myClass</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> my_class<span style="color: #009900;">&#40;</span><span style="color: #000088;">$api_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//this sets a user and session </span>
<span style="color: #000088;">$myClass</span> <span style="color: #339933;">-&gt;</span><span style="color: #004000;">facebook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_user</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$global_user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$global_session</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$myClass</span> <span style="color: #339933;">-&gt;</span><span style="color: #004000;">facebook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">api_client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fbml_refreshImgSrc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2007/10/facebook-fbml_refreshimgsrc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Facebook &#8211; feed.publishTemplatizedAction</title>
		<link>http://joel.neubeck.net/2007/10/facedbook-feedpublishtemplatizedaction/</link>
		<comments>http://joel.neubeck.net/2007/10/facedbook-feedpublishtemplatizedaction/#comments</comments>
		<pubDate>Sun, 14 Oct 2007 17:00:35 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbml]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2007/10/facedbook-feedpublishtemplatizedaction/</guid>
		<description><![CDATA[This past week Facebook added a new method on their REST server for sending news and mini feed stories. The method is “feed.publishTemplatizedAction” and the intent of this method is to replace the existing “feed.publishActionOfUser” with a method that is more “templatized”. Here is a sample we created which is a combination of static text [...]]]></description>
			<content:encoded><![CDATA[<p>This past week Facebook added a new method on their REST server for sending news and mini feed stories. The method is <b>“feed.publishTemplatizedAction”</b> and the intent of this method is to replace the existing “feed.publishActionOfUser” with a method that is more “templatized”. Here is a sample we created which is a combination of static text and data we gathered from a RSS feed. When a users first installs our application we will publish this news story.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="" style="font-family:monospace;">actor_id: <span style="">555555555</span>
title_template:   <span class="br0">&#123;</span>actor<span class="br0">&#125;</span> &lt;fb:if-multiple-actors&gt;are&lt;fb:else&gt;is&lt;/fb:else&gt;
           &lt;/fb:if-multiple-actors&gt; exploring the web’s premier collection of 
            student-produced digital media Made on a Mac. 
title_data: 
body_template: &lt;b&gt;&quot;<span class="br0">&#123;</span>title<span class="br0">&#125;</span>&quot;&lt;/b&gt; Made by &lt;i&gt;<span class="br0">&#123;</span>author<span class="br0">&#125;</span>&lt;/i&gt;  
           - See it at the &lt;a href=&quot;http://url/item.php?itemID=<span class="br0">&#123;</span>id<span class="br0">&#125;</span>&quot;&gt;
           Apple Student Gallery&lt;/a&gt; 
body_data: <span class="br0">&#123;</span>&quot;title&quot;:&quot;Lost&quot;, &quot;author&quot;:&quot;Jared A. Jaworski&quot;,&quot;id&quot;:<span style="">13243</span><span class="br0">&#125;</span> 
body_general: 
image_1: http://url/resize3.php?image=/109.jpg 
image_1_link: http://url/resize4.php?image=/109.jpg 
target_ids:</pre></td></tr></table></div>

<p><img width="436" src="http://joel.neubeck.net/wp-content/uploads/2007/10/fb_news1.gif" alt="Sample" height="302" class="imageframe imgalignleft" /><br />
As illustrated in the sample, if multiple users publish stories where both the title_template and body_template markup strings are identical, as well as the title_data and body_data arrays, then Facebook may aggregated the stories together.  When this occurs, the {actor} token is replaced with the names of all of the users whose actions are being aggregated.   Also note, that the only valid HTML tags supported in the template is the &lt;a&gt;, &lt;b&gt; and &lt;i&gt;.</p>
<p>For more information check out Facebooks wiki at <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction">Feed.publishTemplatizedAction<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2007/10/facedbook-feedpublishtemplatizedaction/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook &lt;fbml:ref../&gt;</title>
		<link>http://joel.neubeck.net/2007/10/facebook-fbml-ref/</link>
		<comments>http://joel.neubeck.net/2007/10/facebook-fbml-ref/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 20:14:01 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[fbml:ref]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2007/10/facebook/</guid>
		<description><![CDATA[For those of you who have embarked on writing a Facebook app, you may have faced the challenge of how to automatically update your profile fbml without forcing a user to take action. The approach I have found most effective is to use the &#60;fbml:ref&#62; tag. Facebook defines this command as a tag which &#8220;fetches [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have embarked on writing a Facebook app, you may have faced the challenge of how to automatically update your profile fbml without forcing a user to take action. The approach I have found most effective is to use the &lt;fbml:ref&gt; tag. Facebook defines this command as a tag which &#8220;fetches and renders FBML from a given ref source – either a ref string &#8220;handle&#8221; you&#8217;ve created using fbml.setRefHandle or a URL that serves FBML. &#8221; When using “fbml.setRefHandle” Facebook stores this FBML on its servers in the form of a hashtable. Using a single push we can update FBML for all users that have our application installed.</p>
<p>For a recent client we were asked to display the first few entries from a RSS feed within a users profile. All Facebook users would see the same entries, until the RSS feed changed. Here is the PHP we used to set a users FBML.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> render_ref_fbml<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$facebook</span><span style="color: #339933;">;</span> 
  try <span style="color: #009900;">&#123;</span> 
    <span style="color: #666666; font-style: italic;">// Set FBML Cache </span>
    <span style="color: #000088;">$refFbml</span> <span style="color: #339933;">=</span> render_narrow_fbml<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$refFbml</span> <span style="color: #339933;">.=</span> render_wide_fbml<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$facebook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">api_client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fbml_setRefHandle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'RssFbml'</span><span style="color: #339933;">,</span><span style="color: #000088;">$refFbml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #666666; font-style: italic;">// Set Profile FBML </span>
    <span style="color: #000088;">$fbml</span> <span style="color: #339933;">=</span> render_css_style<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$fbml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;fb:ref handle=&quot;RssFbml&quot;&gt;'</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$facebook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">api_client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">profile_setFBML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fbml</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
      <span style="color: #990000;">error_log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In a standalone php file we then created a similar function which updated only the FBML stored under the “RssFbml” handle.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> render_ref<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$facebook</span><span style="color: #339933;">;</span> 
  try <span style="color: #009900;">&#123;</span> 
    <span style="color: #666666; font-style: italic;">// Set FBML Cache </span>
    <span style="color: #000088;">$refFbml</span> <span style="color: #339933;">=</span> render_narrow_fbml<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$refFbml</span> <span style="color: #339933;">.=</span> render_wide_fbml<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rssItems</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$facebook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">api_client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fbml_setRefHandle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'RssFbml'</span><span style="color: #339933;">,</span><span style="color: #000088;">$refFbml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
    <span style="color: #990000;">error_log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This php file uses an infinite Facebook session and is called every 30 min by a CRON job.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #cc66cc;">30</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> php <span style="color: #339933;">-</span>f <span style="color: #339933;">/</span><span style="color: #000000; font-weight: bold;">var</span><span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>rss<span style="color: #339933;">.</span>php</pre></td></tr></table></div>

<p></fb:ref></pre>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2007/10/facebook-fbml-ref/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
