title: I can't create an instance of a class on Codeigniter
body: <p>I'm trying to create a instance of a class but I get the following error:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined property: DM_TemplateLoader::$load</p>
    
    <p>Filename: libraries/Form_validation.php</p>
    
    <p>Line Number: 147</p>
    
    <p>Backtrace:</p>
    
    <p>File:
    C:\xampp\htdocs\DataMigrator\ci_my_app\controllers\DM_FormValidator.php
    Line: 13 Function: __construct</p>
    
    <p>File: C:\xampp\htdocs\DataMigrator\index.php Line: 292 Function:
    require_once</p>
    
    <p>Fatal error: Call to a member function helper() on a non-object in
    C:\xampp\htdocs\DataMigrator\ci_my_sys\libraries\Form_validation.php
    on line 147 A PHP Error was encountered</p>
    
    <p>Severity: Error</p>
    
    <p>Message: Call to a member function helper() on a non-object</p>
    
    <p>Filename: libraries/Form_validation.php</p>
    
    <p>Line Number: 147</p>
    
    <p>Backtrace:</p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <p><strong>DM_FormValidator.php</strong></p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class DM_FormValidator extends CI_Controller {
  
      public function index()
      {
          $this-&gt;load-&gt;library('form_validation');
          $this-&gt;form_validation-&gt;set_rules('sender_host', 'Host (Sender)', 'required');
  
          if ($this-&gt;form_validation-&gt;run() == FALSE) {           
              require_once APPPATH . 'controllers/DM_TemplateLoader.php';
              $template_loader = new DM_TemplateLoader();
          }
      }
  }
  </code></pre>
  
  <p><strong>DM_TemplateLoader.php</strong></p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class DM_TemplateLoader extends CI_Controller {
  
      public function view($page = 'home') {  
  
          // Loading the URL helper
          $this-&gt;load-&gt;helper('url');     
  
          if (file_exists(APPPATH . 'views/pages/' . $page . '.php')) {
              $data['page_title'] = 'Data Migrator: Home';
  
              // Building the template
              $this-&gt;load-&gt;view('template/header', $data);
              $this-&gt;load-&gt;view('pages/' . $page);
              $this-&gt;load-&gt;view('template/footer');
          }
          else {
               show_404();
          }   
      }
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>