Coding with Jesse

Code Igniter

May 14th, 2006

I'm absolutely in love. While I bored was at JAX, I searched around for a PHP framework like Ruby on Rails. I already knew about CakePHP, but I wasn't convinced. I looked at a few others, but nothing caught my eye. Then I discovered Code Igniter.

Code Igniter comes from the people who make Expression Engine. I had already heard great things about that, and I had even considered purchasing a license. Code Igniter, however, is free and open source. It's quite new (first beta was released in February) but it is incredibly professional and already very stable.

Code Igniter does absolutely everything I want it to, and nothing I don't want it to. It's incredibly simple and clean, so there are no surprises or weird tricks. It forces you to organize your code using an MVC structure (actually, a VC structure — using a model is optional). This keeps your code cleaner and easier to maintain. It also comes with a number of libraries that help with common web development things like email and uploaded files.

This weekend, I rewrote my whole custom-made blog code for this site. It only took about 4 or 5 hours, and it was actually fun to do. It also reduced the amount of code I had, and makes it much, much easier to maintain and change in the future. For example, until now I was too lazy to add contact pages properly, so I just added blog articles for Contact Me, etc. and pointed links at these. Now, I've changed the pages to use /contact/me and /contact/hire, and I could easily reuse my blog template. This change took about 10 minutes.

By default, URLs are of the form /class/function/parameters. But if you want to do something different (I use /blog/2006/5/article-name), you can set up routing rules for anything you want. Actually, Code Igniter is totally flexible to let you do whatever you want. Anytime I got stuck, I poked around in the documentation and found that there was something in place specifically for my problem.

Also wonderful: only the minimal amount of PHP is loaded to create each page. You can load classes globally, if you need them, but by default, you only load what you need when you need it. This keeps every page as fast as possible, something I was worried about with other frameworks like CakePHP.

Okay, that's enough ranting. If you use PHP, check out Code Igniter. There are some videos you can watch to see just how easy Code Igniter really is. The user guide is also a pleasant read and explains everything really well.


1 . GeoffC on May 15th, 2006


Nice work. I have been playing with CI for a few weeks, tis very nice to work with.

Oh.. and come join us on / #codeigniter


2 . Roberto Bechtlufft on May 18th, 2006

Roberto Bechtlufft

I've been trying to understand MVC for a few weeks, but I always found it too complicated - I'm no PHP pro, I'm just a guy who likes to code now and then. But then I watched the video tutorial in Code Igniters site and, wow, that was a pretty good explanation! I'm already working on my wife's website using Code Igniters. Thumbs up!

3 . Jesse Skinner on May 29th, 2006

Jesse Skinner

I love ruby and rails. But I think php still has it's place. Also, my hosting provider doesn't support ruby. So until my hosting contract expires, I'm pretty much stuck.

Regardless, when using php, Code Igniter is where it's at.

4 . zidane on June 1st, 2006


Is it possible to use it with smarty as a template engine ?

5 . Jesse Skinner on June 2nd, 2006

Jesse Skinner

@zidane - you know, I was just wondering about that yesterday. I've never used smarty, but from what I can tell, you should be able to load smarty, call smarty functions, assign values and call the display function all from within the controllers of Code Igniter. It seems like it would make a great combination.

You also might want to ask/discuss this at the Code Igniter forum:

6 . Fredrik Wärnsberg on June 2nd, 2006

Fredrik Wärnsberg

Why not learn rails? The reason he made rails for ruby and not php was because php wasn't enough for what he was trying to do in the first place.

7 . chris on June 15th, 2006


Just looking through the documentation for CI for an hour or so and it looks very much like what I've been looking for over the past few weeks. So this is just a quick note to thank you for the headsup!

8 . rabi on August 31st, 2006


This is good stuff. Tried it, it was nice. Anything like this for python? Im not a pro just a designer.

9 . Jesse Skinner on August 31st, 2006

Jesse Skinner

@rabi - I've heard only good things about Django (for Python), though I've never tried it out. I'd like to one day, once I get a web server that supports Python...

10 . Chris Lamb on October 26th, 2006

Chris Lamb

Fredrik, I do know Ruby and have built a clients application on Rails.

The problem for me with RoR was getting a server I could rely upon. It really seemed a patchwork muddling with Apache and fastcgi or lighttpd ... and on....

Has the situation improved?

11 . Terry Apodaca on December 6th, 2006

Terry Apodaca

I'm using CI for the first build a website for my family. I'll keep you posted on my findings and experiences.

12 . Jesse Eickholt on January 2nd, 2007

Jesse Eickholt

Just wondering if you'd be willing to share your code for your this blog. I'm looking to play around with CI and revamp my blog. I'd love to see what you did. I nice work with this site. It's very catchy.

13 . Jesse Skinner on January 2nd, 2007

Jesse Skinner

@Jesse - I've thought about releasing my code one day, but I'd want to package it up and make it more reusable first. I'll keep it in mind, and if I ever do, I'll be sure to announce it on here.

14 . angel on January 31st, 2007


hi, could you pls tell me how to use css with codeigniter? this code does not seem to work->

<link href="styles.css" type="text/css" rel="stylesheet">

it's my first time to use a php framework. i'm having trouble installing cakephp and simfony(?) and somehow managed to make codeigniter work (thanks to the video tutorials).

15 . angel on January 31st, 2007


nevermind, i found it out myself. just put the css on the root folder, not on the applications folder/subfolders. =p

16 . jonie on March 7th, 2007


i watched the CI video and i had an orgasm

17 . Rudy on April 3rd, 2007


In Romania 8 March is Mother's Day, so I understood why jonie had an orgasm ... :p

18 . martin on May 8th, 2007


hi there jonie......

r u sure u had an orgasm??wow.......

well i had a fun time learning CI with the help of the tutorial vids..

^^ just had a hard time with the css problem..........

19 . pedro on May 29th, 2007



you guys are talking about CI + orgasms..
It must be good.

20 . Richard on July 17th, 2007


Hey, I have to agree. I just downloaded over the weekend. CI is allot more intuitive than cake, and as it claims - is fast!

21 . Jenny on August 1st, 2007


From what I read, Smarty and Igniter do not really go well together - too much complexity overhead.

I have seen sites that used CI - it is fairly intuitive, BUT the front end and back end are not separated, which is very hard to manage. I would stick with smarty and good software design.

22 . squirre on August 22nd, 2007


hello, i'm a newbie in codeigniter, found same problem with css
but i think i know how to do that now...

i made a newbie tutorial in my blog

23 . kik on November 23rd, 2007


just to mention that CI work pretty well with projax.

24 . Brian on January 8th, 2008


How is the front end and back end not separated in CI? It seems that they are, with the back end submitting finished values to the front end view files when finished.

It looks like it's not as slick as Smarty (ie. <?=$title?> instead of {$title}) but still does the job of separation, or am I missing something?

25 . eenx on March 2nd, 2008


I'll try it, thanks for the review

26 . Mohfeza on March 13rd, 2008


Could you please
let me know if I can get CodeIgnitor hosing?

27 . Jesse Skinner on March 13rd, 2008

Jesse Skinner

@Mohfeza - the great thing about Code Igniter is, all you need is regular PHP web hosting, and you should be able to find that anywhere!

28 . Dhila Pamungkas on May 5th, 2008

Dhila Pamungkas

I'm a real newbie on web programming..
I've never used PHP before..

One of my lecturer hired me to do some portal-making, and urged me to finish it this month with the assistance of CI, which I never used before..

So.. what do you think I should start with?

29 . Jesse Skinner on May 5th, 2008

Jesse Skinner

@Dhila - Start with the CodeIgniter user guide and maybe pick up a good PHP beginner book. A month sounds like a tight crunch for learning and using a new language. Good luck!

30 . JM on August 4th, 2008


Code Igniter is an excellent framework, I'm using it in my two actual projects.

31 . henrihnr on October 16th, 2008


anyone ever tried using DojoToolkit with CodeIgniter?
what do you think bout dojoToolkit to work with CI?
is it a good option? or there's a better option? thx

32 . JM on October 16th, 2008


I didn't use DojoToolkit, but I used jQuery and it fits perfect for CI. I used that combination for all my projects.
Good luck.

33 . Neighbor Webmaster on October 9th, 2009

Neighbor Webmaster

For those who are interested in using Smarty with CodeIgniter, I documented my implementation here . I also include some smarty plugins that make accessing language file information and validation errors easy.

Comments are closed, but I'd still love to hear your thoughts.