Mark O Keeffe
Mark O Keeffe

Reputation: 301

Can't autoload Tank Auth with the Codenigitier

I was able to implement the Tank Auth library with my website, but have an issue when I move the autoload of the library from the Auth controller to the codeignitier autoload library.

As you can see below I have commented out the auto load of the tank Auth library, if I load it here then everything works fine.

class Auth extends MY_Controller
    {
function __construct()
{
    parent::__construct();

       $this->load->helper(array('form', 'url'));
      //$this->load->library('form_validation');
        $this->load->library('security');
 //     $this->load->library('tank_auth');
        $this->lang->load('tank_auth');
}

THIS is now I load it in the codeignitier, as you can see pretty straight forward

$autoload['libraries'] = array('form_validation','email','upload','tank_auth');

this is the controller that I have defined

class MY_Controller extends CI_Controller {

      public $layout;
 public function __construct()
  {

//this sets where the header and footer file is loacated
    parent::__construct();
    $this->layout = 'layout/master';

  }

}

The error I get when autoloading is The model name you are loading is the name of a resource that is already being used: users. Obviously it looks like its trying to create the object twice.

Why would autoloading before the Auth library cause this issue, when its auto loaded anyway in the Auth controller, maybe I'm missing some vital piece of understanding of codignitier.

thanks

Upvotes: 0

Views: 188

Answers (1)

Nishan Hitang
Nishan Hitang

Reputation: 805

Why don't you try renaming the library file? Besides, there is no harm in loading the library in the _construct.

Upvotes: 0

Related Questions