<?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>ria-coder.com &#187; integration</title>
	<atom:link href="http://ria-coder.com/blog/tag/integration/feed" rel="self" type="application/rss+xml" />
	<link>http://ria-coder.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 21 Apr 2010 19:35:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Integrating CodeIgniter with AMFPHP</title>
		<link>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp</link>
		<comments>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp#comments</comments>
		<pubDate>Sun, 02 Nov 2008 21:09:02 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lessons]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[remoting]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=36</guid>
		<description><![CDATA[A while back i spent an evening hacking away at the CodeIgniter source code. I was desperate to use it as a library, as opposed to a framework. I don&#8217;t use PHP with HTML. I did for a little bit, but personally i found that HTML and CSS were the biggest load of shit languages]]></description>
			<content:encoded><![CDATA[<p>A while back i spent an evening hacking away at the CodeIgniter source code. I was desperate to use it as a library, as opposed to a framework. I don&#8217;t use PHP with HTML. I did for a little bit, but personally i found that HTML and CSS <strong>were the biggest load of shit languages ever to plague my existence! </strong>Sorry. Once i was introduced to Flash and Flex, i said <strong>&#8220;to hell with HTML and it&#8217;s ugly sister CSS! I&#8217;m becoming a banner-maker!&#8221;</strong>. Not quite&#8230; i&#8217;ve never made a banner &#8211; even though that&#8217;s like totally the whole point of Flash, dude&#8230; (insert stupid programmer comments here).</p>
<p>Ahem. Back to the point. So when i started writing Flex apps and using AMFPHP for my remoting, i desperately wanted a nice concise, easy-to-use, well documented library. Enter <a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a> by Rick Ellis. Although CI is actually a MVC framework for PHP, i decided i was going to turn it into a library! (and what a ballache that was).</p>
<p>Below is the massive, complex, obfuscated script I wrote to turn it into a library. Notice how the script seems to drip with programming excellence:</p>
<pre><span>&lt;?php
    </span><span>if (!</span><span>defined</span><span>(</span><span>'BASEPATH'</span><span>)) </span><span>define </span><span>(</span><span>"BASEPATH"</span><span>, </span><span>"../CodeIgniter/system/"</span><span>);
    if (!</span><span>defined</span><span>(</span><span>'APPPATH'</span><span>)) </span><span>define </span><span>(</span><span>"APPPATH"</span><span>, </span><span>"../CodeIgniter/system/application/"</span><span>);
    if (!</span><span>defined </span><span>(</span><span>"EXT"</span><span>)) </span><span>define </span><span>(</span><span>"EXT"</span><span>, </span><span>".php"</span><span>);

    require_once (</span><span>BASEPATH</span><span>.</span><span>"codeigniter/Base5.php"</span><span>);
    require_once (</span><span>BASEPATH</span><span>.</span><span>"libraries/Controller.php"</span><span>);
    require_once (</span><span>BASEPATH</span><span>.</span><span>"codeigniter/Common.php"</span><span>);
</span><span>?&gt;</span></pre>
<p>Crazy huh? Haha. Essentially, all this script does is fuck with some of the framework architecture and allow the package to be required in PHP. See the usage below:</p>
<pre>&lt;?php
    require_once("CodeIgniter.php"); // the path to your CodeIgniter.php script as described above</pre>
<pre><span>    </span><span>class </span><span>AMFPHP_CI_Integration
    {
         function __construct() // PHP constructor
         {
                parent::Controller();  // Extend the functionality of the CI Controller class
         }
    }</span></pre>
<p><span></p>
<pre>?&gt;</pre>
<p>And that&#8217;s it! Flimsy and hackerish, i know, but hey&#8230; It works <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Any queries or suggestions are most welcome!</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

