<?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>Tom Reitz &#187; box</title>
	<atom:link href="http://www.tom-reitz.com/tag/box/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tom-reitz.com</link>
	<description>Tech Talk, Catholic Commentary, and American Activism</description>
	<lastBuildDate>Tue, 07 Dec 2010 09:42:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook profile box tips</title>
		<link>http://www.tom-reitz.com/2009/02/17/facebook-profile-box-tips/</link>
		<comments>http://www.tom-reitz.com/2009/02/17/facebook-profile-box-tips/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:13:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[box]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[profile]]></category>

		<guid isPermaLink="false">http://www.tom-reitz.com/?p=105</guid>
		<description><![CDATA[As mentioned in my previous post, I&#8217;ve been finishing up a facebook application, My Sites. Now that it&#8217;s done, I thought I&#8217;d post a few tips on how to add profile boxes to your facebook application, since I found it maddeningly complicated.
For the non-facebook-savy, a profile box is a small box that applications can add to [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in my <a title="ICO images in FaceBook profile boxes" href="/2009/02/09/ico-images-in-facebook-profile-boxes/" target="_self">previous post</a>, I&#8217;ve been finishing up a <a title="FaceBook" href="http://www.facebook.com" target="_blank">facebook</a> application, <a title="FaceBook: My Sites" href="http://apps.facebook.com/my_sites/" target="_blank">My Sites</a>. Now that it&#8217;s done, I thought I&#8217;d post a few tips on how to add profile boxes to your facebook application, since I found it maddeningly complicated.</p>
<p>For the non-facebook-savy, a profile box is a small box that applications can add to your profile&#8217;s &#8220;wall&#8221; or &#8220;boxes&#8221; tabs. They&#8217;re meant to provide a quick glimpse of what&#8217;s happening with the application.</p>
<p>I&#8217;m assuming that you keep a database of Facebook users, and you want to display something about them in the profile box.</p>
<p>The basic code for adding a profile box is below, annotated with copious comments. This is in PHP code, you can do it in other languages, but it&#8217;s what I use. Pop this code into a daily <a title="Wikipedia: Cron" href="http://en.wikipedia.org/wiki/Cron" target="_blank">cron</a> for example, and you&#8217;re good to go.</p>
<blockquote>
<pre style="font-size:11px;">&lt;?php
// This code connects to the facebook API.
@require_once 'facebook-platform/php/facebook.php';
$appapikey = 'facebook app api key';
$appsecret = 'facebook app api secret';
$facebook = new Facebook($appapikey, $appsecret);

// This code connects to your own database.
$BASEURL = "http://example.com/path/to/facebook/app";
$connection = @mysql_connect("server","username","password");
if(!$connection)die("Can't connect to the database at this time.");
$res = @mysql_select_db("database");
if(!$res)die("Site database doesn't seem to exist.");

// This code cycles through each user in the database
$sql="SELECT * FROM users";
$data=@mysql_query($sql);
while($user=mysql_fetch_assoc($data)) {
     // You can, of course, query your database to build these strings
     $WideBox = "Whatever you want a profile box on the 'boxes' tab to say.";
     $MobileBox = "Whatever you want a profile box accessed by a mobile device to say.";
     $NarrowBox = "Whatever you want a profile box on the 'wall' tab to say.";

     // This is the API call, it sets the user's profile box content:
     $facebook-&gt;api_client-&gt;profile_setFBML(
          NULL,        // This is the markup, set to NULL for 'FBML'
          $user['id'],  // ID number of the user whose profile box you want to set
          $WideBox,    // Wide box content for 'boxes' tab
          NULL,        // Deprecated, should always be NULL
          $MobileBox,  // Box content for mobile devices
          $NarrowBox   // Narrow box content for 'wall' tab
     );
}
// Clean up the connection
@mysql_close($connection);
?&gt;</pre>
</blockquote>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.tom-reitz.com%2F2009%2F02%2F17%2Ffacebook-profile-box-tips%2F&amp;linkname=Facebook%20profile%20box%20tips"><img src="/wp-content/themes/organic-theme/img/share_save.gif" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.tom-reitz.com/2009/02/17/facebook-profile-box-tips/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>ICO images in FaceBook profile boxes</title>
		<link>http://www.tom-reitz.com/2009/02/09/ico-images-in-facebook-profile-boxes/</link>
		<comments>http://www.tom-reitz.com/2009/02/09/ico-images-in-facebook-profile-boxes/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 02:54:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[box]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[gif]]></category>
		<category><![CDATA[ico]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jpg]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[profile]]></category>

		<guid isPermaLink="false">http://www.tom-reitz.com/?p=42</guid>
		<description><![CDATA[So I&#8217;ve been developing a FaceBook application, My Sites. It let&#8217;s you bookmark websites you like and share them with your friends.
The Problem
When a FaceBook application tries to add HTML to someone&#8217;s profile box, it can add images, but only in JPG, GIF, or PNG formats. For most uses this is fine, but I needed to add a favicon next [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been developing a FaceBook application, <a title="FaceBook: My Sites" href="http://apps.facebook.com/my_sites/" target="_blank">My Sites</a>. It let&#8217;s you bookmark websites you like and share them with your friends.</p>
<h3>The Problem</h3>
<p>When a FaceBook application tries to add HTML to someone&#8217;s profile box, it can add images, <em>but only in JPG, GIF, or PNG formats</em>. For most uses this is fine, but I needed to add a favicon next to each website in a list, and ICO format isn&#8217;t allowed.</p>
<h3>The Solution</h3>
<p>Using a free php class that can import ICO images to a GD image resource, I converted the favicons to PNGs. Now FaceBook is all happy. Download a ZIP of the icon class <a title="Download ICO PHP Class" href="http://www.tom-reitz.com/wp-content/uploads/2009/02/classicophp.zip" target="_self">here</a>, or directly from <a title="PHPclasses.org" href="http://www.phpclasses.org/browse/file/9705.html" target="_blank">PHPclasses.org</a>.</p>
<p>[<strong>EDIT</strong>: please see my post on the <a title="PHP ICO to PNG conversion" href="/2009/02/17/php-ico-to-png-conversion/" target="_self"><strong>important bug fix</strong></a>]</p>
<h3>The Code</h3>
<p>Here&#8217;s how you use the class:</p>
<blockquote>
<pre><span style="font-size: small;">
&lt;?php
error_reporting(0);
require("ico.class.php");
$f = "http://www.google.com/favicon.ico";
$i = new Ico($f);
if(!($r=$i-&gt;GetIcon(0))) die("Could not load ICO.");
else {
          header("Content-Type: image/png");
          imagepng($r);
}
?&gt;
</span></pre>
</blockquote>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.tom-reitz.com%2F2009%2F02%2F09%2Fico-images-in-facebook-profile-boxes%2F&amp;linkname=ICO%20images%20in%20FaceBook%20profile%20boxes"><img src="/wp-content/themes/organic-theme/img/share_save.gif" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.tom-reitz.com/2009/02/09/ico-images-in-facebook-profile-boxes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

