<?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>Stuck Together With Tape &#187; Code</title>
	<atom:link href="http://www.stucktogetherwithtape.com/blog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stucktogetherwithtape.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 11 Dec 2009 12:49:01 +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>Oi, Mind your Messages</title>
		<link>http://www.stucktogetherwithtape.com/blog/2009/10/oi-mind-your-messages/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=oi-mind-your-messages</link>
		<comments>http://www.stucktogetherwithtape.com/blog/2009/10/oi-mind-your-messages/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 22:03:15 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[notifications]]></category>

		<guid isPermaLink="false">http://www.stucktogetherwithtape.com/blog/?p=78</guid>
		<description><![CDATA[Often, I find I need to send notifications to the user (webpage) during server code. This may be a warning, notification, or a message that an action has hapend. If you&#8217;re using a MVC framework it&#8217;s not practical to exit running code or echo out the message. From a User Interface perspective it is also imperative [...]]]></description>
			<content:encoded><![CDATA[<p>Often, I find I need to send notifications to the user (webpage) during server code. This may be a warning, notification, or a message that an action has hapend. If you&#8217;re using a MVC framework it&#8217;s not practical to exit running code or echo out the message. From a User Interface perspective it is also imperative that the user knows where to look for these notifications and what they mean.<br />
<span id="more-78"></span><br />
This all lead me to develop a re-usable solution to drop into any project. As all most all of the sites I work on use CodeIgniter now, once again a CI Library was the obvious choice. <strong>Oi</strong> is notifications management system that, when stripped to its basic behaviour, has two uses.</p>
<ul>
<li>Stores new notifications added by the application</li>
<li>Returns all unread notices added by the application</li>
</ul>
<p>Pretty Simple. Added to that it will also remember notices between page redirects. So if you add a notice and then reach some code that triggers a redirect the notice will be displayed on the next page.</p>
<p>The library is now in its second incarnation. My original version supported three types of notices</p>
<ol>
<li><strong>Success</strong> (Well done, something that was meant to happen has happened)</li>
<li><strong>Message</strong> (Nothings gone wrong, nothings gone right. Just wanted to say a little something)</li>
<li><strong>Error</strong> (Oh shit, what did you do? Now i&#8217;m gonna have to tidy up after you again!)</li>
</ol>
<p>Each message would be returned as separate elements with a relevant class representing the type. This was pretty sufficient for most applications but there were times when I wanted to add more attributes (classes, titles, ids) or just needed another &#8216;type&#8217;.</p>
<p>So the new version uses the magic php method __call to provide an unlimited number of &#8216;types&#8217; via the method $oi-&gt;add_{<strong>type</strong>}($string);</p>
<p>e.g.<br />
<code>$this-&gt;oi-&gt;add_message('Well Done');</code></p>
<p>or</p>
<p><code>$this-&gt;oi-&gt;add_reallylongandimpressivesupertype('Hello');</code></p>
<p>More examples and documentation available in the <a href="http://www.stucktogetherwithtape.com/code">code</a> section</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stucktogetherwithtape.com/blog/2009/10/oi-mind-your-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shortie v1.0 Released</title>
		<link>http://www.stucktogetherwithtape.com/blog/2009/10/shortie-v1-0-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=shortie-v1-0-released</link>
		<comments>http://www.stucktogetherwithtape.com/blog/2009/10/shortie-v1-0-released/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 21:37:51 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[shortie]]></category>
		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://www.stucktogetherwithtape.com/blog/?p=54</guid>
		<description><![CDATA[Recently I needed code to shorten URLS and tweet said url as a twitter update. This all needed to happen in their existing CMS built using Codeigniter. Turns out the twitter part was easy, thanks to simonmaddox&#8217;s nice twitter CI library. I got a few whiffs of a url shortening CI library around the web, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed code to shorten URLS and tweet said url as a twitter update. This all needed to happen in their existing CMS built using Codeigniter.</p>
<p>Turns out the twitter part was easy, thanks to <a href="http://github.com/simonmaddox/codeigniter-twitter" target="_blank">simonmaddox&#8217;s nice twitter CI library</a>. I got a few <a href="http://codeigniter.com/forums/viewthread/113285/" target="_blank">whiffs</a> of a url shortening CI library around the web, but it looks like the code was no longer available. Oh well, a good excuse to knock up a new library!</p>
<p><span id="more-54"></span></p>
<p><a href="http://www.stucktogetherwithtape.com/code/shortie" target="_blank">Shortie</a> is a simple library that uses curl to generate short urls using a number of different services. At the moment I have added support for four services:</p>
<ul>
<li>tr.im</li>
<li>tinyurl</li>
<li>is.gd</li>
<li>u.nu</li>
</ul>
<p>Check out the <a href="http://www.stucktogetherwithtape.com/code/shortie" target="_blank">user guide</a>, which was created using an app-in-progress <strong>Dokument</strong>, for examples.</p>
<p>More about Dokument later&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stucktogetherwithtape.com/blog/2009/10/shortie-v1-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
