Geronimo89.dk

A blog about me, my doings and everything I think deserves attention.

CodeIgniter, my personal ignition

ci logo flame CodeIgniter, my personal ignitionOkay folks, I should tell you, I’m not missing any limbs, my apartment wasn’t on fire and not even my computer. Anyways I have been digging into the PHP framework CodeIgniter. Originally CI was brought to my attention by Kenneth and recently I picked up a project that really screamed for dynamic structure, scalability and classes with some built-in security features.

What I think is remarkably positive about the framework, is that the user guide actually is shipped with it, so you easily can start learning it without constantly being on the net.

CodeIgniter does well what frameworks should do. Distribute versatile tools for faster development of common tasks. It’s like a workbench for webdevs.

The first thing I noticed when I was watching the series of video tutorials on net.tutsplus.com called CodeIgniter from Scratch, that the naming conventions have been changed. To be fair it has to be said, that these video tutorials were submitted in 2009.

What exactly changed?

The internal naming conventions of classes!

// before:
class Site extends Controller {
    function foo(){
    };
};

// now:
class Site extends CI_Controller {
    function foo(){
    };
};

If you don’t take this into account you’ll receive error messages like:

Fatal error: Class ‘Controller’ not found

Now if you think I’m paid by the tutsplus guys, you’re wrong, but still here’s a list of chapters, covered in the video lessons:
Overview of chapters:

  1. Getting Started With the Framework
  2. Database Selecting Methods
  3. Sending EmailsNewsletter
  4. Signup
  5. CRUD
  6. Login
  7. Pagination
  8. AJAX
  9. File Uploading and Image Manipulation
  10. The Calendar Library
  11. File and Directory Operations
  12. Shopping Cart
  13. Extending the Framework
  14. Security
  15. Profiling, Benchmarking and Hooks
  16. Displaying & Sorting Tabular Data
  17. Search Results without Query Strings

You don’t have to watch them in this order, because mostly you can learn independently about the separate chapters. Though I would recommend, that you in any case start out with 1, because it also gives you an idea how the model, view, controller (MVC) pattern works.

I really thank the author, Jeffrey Way, for making this series. He’s done very well, although sometimes not everything is planned out, facebook is accidentally open, typos happen and sometimes windows are switched to switch back again. This all still makes it authentic and the quality of the screen cast is improving with every episode.

I’m not through with all the videos, but so far I can really recommend them.

EDIT: Wed May  4 03:00:48 CEST 2011
I just noticed, that in episode 6 there was an error I could not easily overcome. I got the following error message:
Fatal error: Call to undefined method CI_Controller::Controller() in /Users/gero/Sites/my_proj/application/controllers/site.php on line 7

file: site.php

// before:
function __construct()
{
	parent::Controller();
	$this->is_logged_in();
}

// fix:
function __construct()
{
	parent::__construct();
	$this->is_logged_in();
}

Simply change the Controller to __construct and you’re going again. In the CI forums it’s recommended to use a library for authentication though.

2 comments already

2 Responses to “CodeIgniter, my personal ignition”

  1. [...] Coding my most complex website so far without a CMS, but with CodeIgniter [...]

  2. [...] Coding my most complex website so far without a CMS, but with CodeIgniter [...]

Leave a Reply