<?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>I swore I wouldn&#039;t &#187; zend</title>
	<atom:link href="http://www.wontblog.com/tag/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wontblog.com</link>
	<description>Oh no, I&#039;m blogging now?</description>
	<lastBuildDate>Wed, 23 Feb 2011 20:06:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>First Impressions of Code Igniter</title>
		<link>http://www.wontblog.com/2010/06/05/first-impressions-of-code-igniter/</link>
		<comments>http://www.wontblog.com/2010/06/05/first-impressions-of-code-igniter/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 12:28:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Host]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.wontblog.com/?p=56</guid>
		<description><![CDATA[Last night I was forced to start working with CodeIgniter, a PHP web-framework, and I have to say that so far I am enjoying the experience. CodeIgniter provides a simple framework that allows you to quickly get an application up and running.  The learning curve (so far) has been very low.  I like web-frameworks for [...]]]></description>
			<content:encoded><![CDATA[<p><!--digg--><br />
<img class="alignright" title="Code Igniter" src="http://img.skitch.com/20100605-xpp9a9s6win5rjkq6dwd2g93qw.jpg" alt="Code Igniter" width="288" height="220" /> Last night I was forced to start working with <a href="http://www.codeigniter.com/" target="_BLANK">CodeIgniter</a>, a PHP web-framework, and I have to say that so far I am enjoying the experience.</p>
<p>CodeIgniter provides a simple framework that allows you to quickly get an application up and running.  The learning curve (so far) has been very low.  I like web-frameworks for projects.  I have done a number of projects in Ruby on Rails, and I have dabbled in Django.  Those have been pleasant experiences, but I prefer PHP as my preferred development language for most projects due to a number of reasons (not interested in jumping into that holy war right now.)</p>
<p>Up to this point, if I wanted to use a PHP framework, my choices were Zend and CakePHP.  Zend is a monster.  I&#8217;m sorry, I know a lot of developers swear by Zend, but I&#8217;m not one of them.  Nobody &#8220;quickly&#8221; picks up Zend.  Zend is so incredibly dense/bloated/abstracted that debugging something becomes an exercise that is more time consuming than the original problem that you were trying to solve.  CakePHP felt too much like I was pretending to be Ruby on Rails, and there were so many hoops to jump through.  And it was frequently a little &#8220;too magical.&#8221;</p>
<p>After exploring these different options, I wrote my own framework that took the parts of Ruby on Rails that I enjoyed, but kept the flexibility and familiarity of PHP.  I have been using this for over a year now and it has served me well.  I was pleased to find that the structure of CodeIgniter was <em>almost identical</em> to the structure of my own framework.  This has made it a very easy switch for me.</p>
<p><span id="more-56"></span></p>
<p>The only problem that I have run into so far was briefly not understanding how to get to a GET parameter in a fashion that didn&#8217;t make me feel dirty.</p>
<p><em>Tangent about accessing GET parameters coming&#8230;</em><br />
CodeIgniter obscures the $_GET parameters by default, you can enable them within your configuration, but I am working on one page of an existing site as a favor for a friend.  The CodeIgniter documentation suggests that you retrieve the parameters based on &#8220;segments&#8221; so if you wanted to pass in</p>
<blockquote><p>http://www.mysite.com/events.php?start=25&amp;state=VA&amp;count=50</p></blockquote>
<p>CodeIgniter suggests that you would generate the url</p>
<blockquote><p>http://www.mysite.com/events/index/25/VA/50</p></blockquote>
<p>And then retrieve your parameters based on which &#8220;segment&#8221; they were.<br />
<code><br />
segment(3) =&gt; 25 // the 'start' value<br />
segment(4) =&gt; VA // the 'state' value<br />
segment(5) =&gt; 50 // the 'count' value<br />
</code><br />
This makes me cringe for many reasons.  What if, for example, the user can click a link to change the count to 25, but it defaults to 50.  Most of the time this isn&#8217;t going to happen, so would I ALWAYS assume that I&#8217;m passing in the first segment as the start param, even when it&#8217;s typically not going to be used?</p>
<p><strong>uri_to_assoc to the rescue</strong><br />
The solution to this &#8220;issue&#8221; (it&#8217;s more of my own issue than an actual problem) was the function uri_to_assoc.<br />
Using uri_to_assoc means that I could format my urls as:</p>
<blockquote><p>http://www.mysite.com/events/index/start/25/state/VA/count/50</p></blockquote>
<p>and then in my code use:<br />
<code><br />
$params = $this-&gt;uri-&gt;uri_to_assoc(3);</code></p>
<p><code> </code></p>
<p><code>/* I now have the array $params with:<br />
* $params['state'] = 'VA'<br />
* $params['state'] = 25<br />
* $params['count'] = 50<br />
*/<br />
</code><br />
This makes me much more comfortable, as it means that it doesn&#8217;t matter where in the URI that my parameters are positioned.<br />
<em>Tangent finished</em><br />
I plan to continue using CodeIgniter for a while, to see if it&#8217;s the right fit.  I have some small projects that it would likely be quite appropriate for, and it will get me out of the business of supporting my own framework.  <img src='http://www.wontblog.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.wontblog.com/2010/06/05/first-impressions-of-code-igniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

