<?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; codeigniter</title>
	<atom:link href="http://ria-coder.com/blog/tag/codeigniter/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>Handling multiple remote services with RemoteObject &#8211; the easy way!</title>
		<link>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way</link>
		<comments>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way#comments</comments>
		<pubDate>Tue, 05 May 2009 22:16:03 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[FaultEvent]]></category>
		<category><![CDATA[remoteobject]]></category>
		<category><![CDATA[ResultEvent]]></category>
		<category><![CDATA[service calls]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=271</guid>
		<description><![CDATA[Here's a quick and easy way to handle multiple service calls in two simple event handlers!]]></description>
			<content:encoded><![CDATA[<p>Ok, so you&#8217;re developing a Flex application with a bit of server-side integration (using PHP, Java, Ruby, .NET, etc) and your application is getting a little intense; multiple service calls to the server, custom logic for success and failure of said calls and everything in between.</p>
<p>You could use the following syntax for handling mutliple method-calls from a remote script (in this example <em>MyService</em>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000;">&quot;service&quot;</span> destination=<span style="color: #ff0000;">&quot;amfphp&quot;</span> source=<span style="color: #ff0000;">&quot;MyService&quot;</span> makeObjectsBindable=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:method</span> name=<span style="color: #ff0000;">&quot;doSomething&quot;</span> result=<span style="color: #ff0000;">&quot;doSomethingResult(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;doSomethingFault(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:method</span> name=<span style="color: #ff0000;">&quot;doAnotherSomething&quot;</span> result=<span style="color: #ff0000;">&quot;doAnotherSomethingResult(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;doAnotherSomethingFault(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:RemoteObject</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;"> 	&lt;![CDATA[</span>
<span style="color: #339933;">		private function doSomethingResult(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doSomethingFault(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doAnotherSomethingResult(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doAnotherSomethingFault(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
<span style="color: #339933;"> 	]]&gt;</span>
<span style="color: #339933;">&lt;/mx:Script&gt;</span></pre></td></tr></table></div>

<p>I dunno about you, but to have to define <strong>special</strong> tags in MXML for each bloody method in your script is too much effort (and can leave you with some nasty/tricky bugs if you forget to add a new tag after adding a new method in your server-side script!). I used the following mechanism in my post about <a title="Integrating CodeIgniter, Flex and PHP" href="http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects/" target="_blank">integrating CodeIgniter, Flex and PHP</a> if i remember correctly&#8230; Give me a break&#8230; I was too lazy to check (it&#8217;s midnight and i&#8217;m sleepless).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000;">&quot;service&quot;</span> destination=<span style="color: #ff0000;">&quot;amfphp&quot;</span> source=<span style="color: #ff0000;">&quot;MyService&quot;</span> makeObjectsBindable=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">result=<span style="color: #ff0000;">&quot;resultHandler(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;faultHandler(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;"> 	&lt;![CDATA[</span>
<span style="color: #339933;">		private function resultHandler(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			var message:RemotingMessage = event.token.message as RemotingMessage;</span>
&nbsp;
<span style="color: #339933;">			switch(message.operation)</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				case &quot;doSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				case &quot;doAnotherSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				default:</span>
<span style="color: #339933;">					trace(&quot;Shit... Missed this one... &quot; + message.operation);</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function faultHandler(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			var message:RemotingMessage = event.token.message as RemotingMessage;</span>
&nbsp;
<span style="color: #339933;">			switch(message.operation)</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				case &quot;doSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				case &quot;doAnotherSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				default:</span>
<span style="color: #339933;">					trace(&quot;Shit... Missed this one... &quot; + message.operation);</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">		}</span>
<span style="color: #339933;"> 	]]&gt;</span>
<span style="color: #339933;">&lt;/mx:Script&gt;</span></pre></td></tr></table></div>

<p>Seems much easier, doesn&#8217;t it? Essentially all you&#8217;re doing is examining the event parameter of the ResultEvent or FaultEvent, finding which method was just called and acting accordingly&#8230; This will work with any number of method calls, from any number of different RemoteObjects. You can point them all to the same handlers!</p>
<p>If you guys have any alternative ways of doing this, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using PHP to Backup and Save your MySQL Database</title>
		<link>http://ria-coder.com/blog/using-php-to-backup-and-save-your-mysql-database</link>
		<comments>http://ria-coder.com/blog/using-php-to-backup-and-save-your-mysql-database#comments</comments>
		<pubDate>Fri, 17 Apr 2009 13:30:35 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[david walsh]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[rick ellis]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=255</guid>
		<description><![CDATA[While working on a recent project, i needed to set up a cron job that would run every X amount of hours and backup a database Here's a class i made to do just that!]]></description>
			<content:encoded><![CDATA[<p>While working on a recent project, i needed to set up a cron job that would run every X amount of hours and backup a database. I&#8217;ve done this a few times before, but only this time (while Googling for a better solution) i found <a title="David Walsh's Blog" href="http://davidwalsh.name/" target="_blank">David Walsh</a>&#8216;s blog post on how to <a href="http://davidwalsh.name/backup-mysql-database-php">Backup Your MySQL Database Using PHP</a>. David&#8217;s done a great job and i definitely recommend you check his blog out in its entireity for some really neat web dev articles.</p>
<p>I decided to go and put David&#8217;s script into class form (my case of OCD is genuine <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ) and i added one or two things to it. Basically it allows you to backup one or many tables in a database, include or exclude the data from the backup and i also included Rick Ellis&#8217; (of CodeIgniter fame) Zip class to allow you to zip up the backup and stash it somewhere.</p>
<p>Thanks to David Walsh and Rick Ellis!</p>
<p>Here&#8217;s the class: <a href="http://ria-coder.com/blog/wp-content/uploads/2009/04/DatabaseDump.php.txt">DatabaseDump.php</a></p>
<p>&#8230;and here&#8217;s how to use it:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dump</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DatabaseDump<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;destination/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dump</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>backup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Be sure to check out the DatabaseDump.php class for the documentation!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/using-php-to-backup-and-save-your-mysql-database/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Integrating Flex, AMFPHP and CodeIgniter (also including Value-Objects)</title>
		<link>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects</link>
		<comments>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects#comments</comments>
		<pubDate>Mon, 05 Jan 2009 15:40:54 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lessons]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=102</guid>
		<description><![CDATA[Yesterday i recorded a video tutorial on integrating Flex, AMFPHP and CodeIgniter. This tutorial will walk you through each step of the process. If you have any questions, please post them as comments and i'll answer them as best i can.]]></description>
			<content:encoded><![CDATA[<p><script src="swfobject/swfobject.js" type="text/javascript"></script> <script type="text/javascript"><!--
	swfobject.registerObject("myFlashContent", "9.0.0", "expressInstall.swf");
// --></script></p>
<div>Yesterday i recorded a video tutorial on integrating Flex, AMFPHP and CodeIgniter. This tutorial will walk you through each step of the process. If you have any questions, please post them as comments and i&#8217;ll answer them as best i can.<span id="more-102"></span></div>
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="318" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="id" value="myFlashContent" /><param name="src" value="http://ria-coder.com/blog/videos/Blog%20Version.swf" /><embed id="myFlashContent" type="application/x-shockwave-flash" width="400" height="318" src="http://ria-coder.com/blog/videos/Blog%20Version.swf"></embed></object></div>
<div><a title="Full-size Video" href="http://ria-coder.com/blog/videos/Integrating%20Flex,%20AMFPHP%20and%20CodeIgniter.swf" target="_blank">Here</a> is a link to the larger version of the tutorial,</div>
<div><a title="Project Files" href="http://ria-coder.com/blog/videos/remoting-example.7z" target="_blank">here</a> is a link to the project files and</div>
<div><a title="Database" href="http://ria-coder.com/blog/videos/users.sql" target="_blank">here</a> is the database dump</div>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<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>

