title: codeigniter: extending common controller
body: <p>I've read all the post I found regarding this issue but nothing works. I'm using Codeigniter 2.02 in a LAMP with Apache2.2 and PHP5.3.2</p>
  
  <p>I'm trying to create a common controller from which my common controllers will inherit so I can do common tasks there.</p>
  
  <p>I have this:</p>
  
  <h3>file: parent_controller.php</h3>
  
  <pre><code>if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Parent_controller extends CI_Controller {
  
      public function Parent_controller()
      {
          parent::__construct();
      }
  
      public function index() {
          echo "Hi!";
      }
  }
  </code></pre>
  
  <h3>file: welcome.php</h3>
  
  <pre><code>if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Welcome extends Parent_controller {
  
      public function __construct()
      {
          parent::__construct();
      }
  }
  </code></pre>
  
  <p>I've tried the next solutions I've found, but none of them are working:</p>
  
  <ul>
  <li><p>public function __contstruct() <strong>instead of</strong> public function Parent_controller() </p></li>
  <li><p>parent::Parent_controller(); </p></li>
  <li><p>put the parent_controller.php file into <strong>core</strong> </p></li>
  <li><p>put the parent_controller.php file into <strong>controllers</strong> </p></li>
  <li><p>adding this to config/config.php:</p>
  
  <pre><code>function __autoload($class){
          if (file_exists(APPPATH."(controllers|core)/".$class.EXT)){
               require_once(APPPATH.'(controllers|core)/'.$class.EXT);
         }
  }
  </code></pre></li>
  </ul>
  
  <p>Thank you all.</p>