<?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>atworkinthecloud.blog &#187; facebook</title>
	<atom:link href="http://atworkinthecloud.com/blog/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://atworkinthecloud.com/blog</link>
	<description>Est. 2008, Jim Olson Owner/Operator</description>
	<lastBuildDate>Mon, 26 Jul 2010 04:11:19 +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>Adding Facebook Share to Drupal</title>
		<link>http://atworkinthecloud.com/blog/2009/11/adding-facebook-share-to-drupal/</link>
		<comments>http://atworkinthecloud.com/blog/2009/11/adding-facebook-share-to-drupal/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 02:56:28 +0000</pubDate>
		<dc:creator>jim</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[social networking]]></category>

		<guid isPermaLink="false">http://blog.atworkinthecloud.com/?p=398</guid>
		<description><![CDATA[I&#8217;ve seen a few people on drupal.org how to implement Facebook Share and asking for modules, etc. However with the share widget provided by Facebook it&#8217;s really very easy to implement FB Share at the template level. To make it really easy, use CCK. Step One: Get the Widget To start off, FB provides you [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.atworkinthecloud.com/wp-content/uploads/2009/11/GPN-2000-000353.jpg" alt="Adding facebook share to drupal" /></p>
<p>I&#8217;ve seen a few people on drupal.org how to implement <a href="http://www.facebook.com/facebook-widgets/share.php">Facebook Share</a> and asking for modules, etc. However with the share widget provided by Facebook it&#8217;s really very easy to implement FB Share at the template level. To make it really easy, use <a href="http://drupal.org/project/cck">CCK</a>.<br />
<span id="more-398"></span></p>
<h2>Step One: Get the Widget</h2>
<p>To start off, FB provides you with this code in their <a href="http://www.facebook.com/facebook-widgets/share.php" target="_blank">widgets section</a></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a name=&quot;fb_share&quot;&gt;&lt;/a&gt;&lt;script src=&quot;http://static.ak.fbcdn.net/connect.php/js/FB.Share&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;</pre></div></div>

<p>Which gives you a little widget on your webpage that looks like this,</p>
<p><img src="http://blog.atworkinthecloud.com/wp-content/uploads/2009/11/fbshare-preview.png" alt="facebook share preview" /></p>
<p>That&#8217;s pretty quick and easy. Using that bit of javascript you&#8217;ll get a little FB button that you can stick basically anywhere on a page (or, more precisely in your node.tpl.php file) and when the user clicks it, they&#8217;ll be prompted to login to facebook (if they&#8217;re not already) and then they can share your link on their wall. FB is pretty good at scraping pages but if you want fine tune control over what image and what text is displayed with your link you need to go a step further.</p>
<h2>Step Two: Take Control!</h2>
<p>As an example, this is the code I added to my page.tpl.php template right underneath my &lt;title&gt; tag:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">//</span></pre></div></div>

<p>I&#8217;ve made references to three variables here; <strong>$title</strong> is just the title of my page, <strong>$node-&gt;field_fblink_teaser[0]['safe']</strong> is a CCK field that I&#8217;ve created which allows users to specify a meta description of their page and lastly <strong>$node-&gt;field_fblink_image[0]['filepath']</strong> is an image that user uploads that is used to create a thumbnail for the FB Share wall post. I&#8217;ve defaulted this image to 100x100px since that is what FB seems to like. For more info on linking different kinds of media including audio and video, check out <a href="http://wiki.developers.facebook.com/index.php/Connect/Implementing_Facebook_Share">this page</a>. Although there are no guidelines given anywhere else, FB does actually have minimum/maximum sizes for images, so if you&#8217;re image isn&#8217;t showing up try changing the dimensions.</p>
<p>In the end you should end up with a wall post that looks like this,</p>
<p><img class="alignnone size-full wp-image-399" title="fbshare" src="http://blog.atworkinthecloud.com/wp-content/uploads/2009/11/fbshare.jpg" alt="fbshare" width="542" height="154" /></p>
<p><em>Disclaimer: I don&#8217;t advocate using Facebook. For anything. It&#8217;s a popular platform and website, yes. But you should be aware that Facebook likes to change their rules, often without warning. It can be a bit of a nightmare for developers. That said, Facebook Share is relatively low-impact though (all authentication takes place via facebook) and that makes it quick to implement.</em></p>
<p>Updated on April 4, 2010, plugin update killed my example code.</p>
]]></content:encoded>
			<wfw:commentRss>http://atworkinthecloud.com/blog/2009/11/adding-facebook-share-to-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
