<?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>Blog by Ben &#187; Tutorial</title>
	<atom:link href="http://blogbyben.co.uk/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogbyben.co.uk</link>
	<description>Design, tech, music and anything else I stumble on...</description>
	<lastBuildDate>Thu, 05 Aug 2010 22:22:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Micro-blogging with Twitter</title>
		<link>http://blogbyben.co.uk/2009/02/micro-blogging-with-twitter/</link>
		<comments>http://blogbyben.co.uk/2009/02/micro-blogging-with-twitter/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 14:05:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Micro-blog]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blogbyben.co.uk/?p=8</guid>
		<description><![CDATA[The folks over at Think Vitamin had a jolly clever idea about using Twitter and #tags to create a micro-blog, which they have used to power the news section on the Think Vitamin site.
Ryan Carson wrote a great write up on how they had gone about doing this but it turns out I can&#8217;t run [...]]]></description>
			<content:encoded><![CDATA[<p>The folks over at <a href="http://thinkvitamin.com/" target="_blank">Think Vitamin</a> had a jolly clever idea about using Twitter and #tags to create a micro-blog, which they have used to power the news section on the Think Vitamin site.</p>
<p><a href="http://twitter.com/ryancarson" target="_blank">Ryan Carson</a> wrote a great write up on how they had gone about doing this but it turns out I can&#8217;t run atom-html.php on my servers &#8211; so this is my variation on their concept.</p>
<p><strong>How do you do it then?</strong></p>
<p>I&#8217;m not one to steal other peoples thunder &#8211; so follow the guide <a href="http://thinkvitamin.com/features/how-to-create-an-rss-enabled-micro-blog-with-twitter/" target="_blank">here at Think Vitamin</a> &#8211;  They cover why you&#8217;d want to do it, where to start, how choose your hash tag and to find your create your atom feed.  When you get to <strong><span style="font-weight: normal;"><em>Output the Atom Feed as HTML</em></span> </strong>section<strong> </strong>head back here.</p>
<p>Right &#8211; done all that?  Good.</p>
<p>Now, on the servers I host this site on <em>allow_url_fopen()</em> is a disabled function due security risk it poses (please don&#8217;t ask me anything else about this &#8211; that&#8217;s what I was told!) so I can&#8217;t use so the atom-html.php file that Ryan uses.</p>
<p><a href="http://magpierss.sourceforge.net/" target="_blank">MagpieRSS</a> was recommended to me and its pretty easy to set up.</p>
<p>So, down download the MagpieRSS files from <a href="http://sourceforge.net/project/showfiles.php?group_id=55691&amp;package_id=50728&amp;release_id=368750" target="_blank">here</a>.</p>
<p>Once you&#8217;ve got that downloaded open the MagpeRSS folder create a new folder on your hosting space called <em>magpierss</em> and upload these files: <em>rss_fetch.inc</em>, <em>rss_parser.inc</em>, <em>rss_cache.inc</em>, and <em>rss_utils.inc</em> plus the directory <em>extlib</em> in to the folder you just created.  It is all explaned in the INSTALL doc that comes with MagpieRSS if you get lost.</p>
<p>Still with me?  Ace.  Now you need to create a new .php webpage (or use an existing .php page).  Somewhere in the &lt;body&gt; tags add the following code:</p>
<blockquote><p>&lt;?php</p>
<p>require_once(&#8216;magpierss/rss_fetch.inc&#8217;);</p>
<p>$url = &#8216;http://www.yourtwittersearchfeedhere.com&#8217;;</p>
<p>$rss = fetch_rss( $url );</p>
<p>echo &#8220;&lt;ul&gt;&#8221;;</p>
<p>$count=1;</p>
<p>foreach ($rss-&gt;items as $item) {</p>
<p>echo &#8220;&lt;li&gt;&#8221;. &#8220;&#8221;. $item['title'] .&#8221;&lt;/a&gt;&lt;/li&gt;&#8221;;</p>
<p>$count ++;</p>
<p>if($count==10){ break;}</p>
<p>}</p>
<p>echo &#8220;&lt;/ul&gt;&#8221;;</p>
<p>?&gt;</p></blockquote>
<p>Replace http://www.yourtwittersearchfeedhere.com with the feed you copied from <a href="http://search.twitter.com/" target="_blank">http://search.twitter.com/</a></p>
<p>If you don&#8217;t want to limit the number of tweets you display remove:</p>
<blockquote><p>$count ++;</p>
<p>if($count==10){ break;}</p></blockquote>
<p>Then save and upload.  A there you go &#8211; your very own twitter powered micro-blog.</p>
<p>You can style the feed using the &lt;li&gt; tag. For example on my example site I have styled it like this:</p>
<blockquote><p> li {</p>
<p> </p>
<p><span> </span>color:#666;</p>
<p><span> </span>font-size:120%;</p>
<p><span> </span>margin:20px 0 ;</p>
<p><span> </span>padding-bottom:20px;</p>
<p><span> </span>border-bottom: solid 1px #111;</p>
<p><span> </span>border-right:30px solid #000;</p>
<p><span> </span>}</p></blockquote>
<p> </p>
<p>I&#8217;m sure there is loads more that can be done &#8211; if you&#8217;ve any ideas let me know.  The next thing I&#8217;d like to do is hide the #tag or at least style it and maybe add the date and time the tweet was posted, but that will have to wait until I have more time to explore MagpieRSS.</p>
<p>Here&#8217;s any example of it in action: <a href="http://www.blogbyben.co.uk/fitness">http://www.blogbyben.co.uk/fitness</a></p>
<p>Thanks to <a href="http://twitter.com/ryancarson" target="_blank">Ryan Carson</a> of <a href="http://www.carsonified.com/" target="_blank">Carsonifed</a> and <a href="http://thinkvitamin.com/" target="_blank">Think Vitamin</a> for the idea and inspiration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogbyben.co.uk/2009/02/micro-blogging-with-twitter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
