Welcome Guest, Not a member yet? Register   Sign In
Extending Controller
#7

[eluser]Nexus Rex[/eluser]
I also have a similar issue:

File: system/application/libraries/My_controller.php
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// application/libraries/My_controller.php

class My_controller extends Controller {

  var $partial = 'debug/echo';

  function My_controller() {
    parent::Controller();
    $this->_get_partial();
    $this->_get_model();
  }
  
  function _get_partial() {
    $uri = $this->router->class . '/' . $this->router->method;
    if (is_file(realpath(dirname(__FILE__) . '/../views/' . $uri . EXT))) {
      $this->partial = $this->router->class . '/' . $this->router->method;
    }
  }
  
  function _get_model() {
    $uri = substr($this->router->class, 0, -1);
    if (is_file(realpath(dirname(__FILE__) . '/../models/' . $uri . EXT))) {
      $this->load->model($uri);
    }
  }

}

When I try to create a members controller that extends My_controller I get an error.

FATAL ERROR: Class 'My_controller' not found in /home/latinole/public_html/directory/system/application/controllers/members.php on line 3

I have tried autoloading the library, moving it to /system/application/controllers/, all to no avail.


Messages In This Thread
Extending Controller - by El Forum - 03-21-2008, 05:28 PM
Extending Controller - by El Forum - 03-21-2008, 06:04 PM
Extending Controller - by El Forum - 03-21-2008, 09:19 PM
Extending Controller - by El Forum - 03-21-2008, 09:41 PM
Extending Controller - by El Forum - 03-31-2009, 03:01 AM
Extending Controller - by El Forum - 03-31-2009, 08:56 AM
Extending Controller - by El Forum - 05-24-2009, 06:35 AM
Extending Controller - by El Forum - 05-24-2009, 07:22 AM
Extending Controller - by El Forum - 05-24-2009, 07:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB