I’ve started looking at CodeIgniter to help simplify my development efforts (vs. coding everything from scratch for each new project).

To get familiar with CodeIgniter I followed their VideoTutorials but soon found myself in “troubleshooting mode”.

A minor discrepancy was between the class names - CodeIgniter now uses the CI_ prefix on the core classes. The video tutorial showed the controller class name as Controller. Setting my code to CI_Controller fixed that small problem.

Everything was going well until the end of the video. The final instructions to build a constructor caused my code to throw a Call to undefined method error.

I eventually found the answer as I was looking over the config.php file. The Class Extension Prefix section had two URL’s to the CodeIgnitor User Guide for classes and libraries. At the bottom of the Core Classes page, I found new examples of creating the class. So; here is what wasn’t working.. and throwing the Call to undefined method error:

...
class Blog extends Controller {

  function Blog()          <--- PROBLEM
  {
    parent::Controller;    <--- PROBLEM

  }

 function index()
 {
   $data['title'] = "My Blog Title";
   $data['heading'] = "My Blog Heading";
   $data['todo'] = array('clean house','eat lunch','call mom');
   
  $this-&gtload-&gtview('blog_view', $data);
 }
}
...

And here is the change that fixes the issue:

...
class Blog extends CI_Controller {

  function __construct()     <-- CORRECTED
  {
    parent::__construct();   load->view('blog_view', $data);
 }
}
...

I looked back at the VideoTutorial page and found the comment "Sorry, we currently don’t have any new tutorials" and below that "The following tutorials are based on older versions of the CodeIgniter software, and as such may contain outdated code."

As most people, I went strait to the video (because I was soo excited to get started) and missed the disclaimer.

I tried to find a “Comments” for the page but found none. I would have suggested they make this more obvious. Simply putting the disclaimer right above the image link in bolded text would help avoid this.