Welcome Guest, Not a member yet? Register   Sign In
Loading 2 libraries in an array and loading second in array causes error
#1

[eluser]Unknown[/eluser]
Hi all,
New to CodeIgniter but getting the hang of it but coming up against an odd issue.

CONTROLLER:
Code:
function index() {
//Call Libraries
$this->load->library(array('securitycheck', 'apiaccess'));

$this->securitycheck->runSecurityCheck(); // Checks if the user is logged in and what to do

//Functiom
$data['apicall'] = $this->apiaccess->viewAccount('xxx'); // Does API stuff
$this->load->view('home', $data);
}

It loads the first library fine ($this->securitycheck->runSecurityCheck()Wink but not the second one, I get this error: Message: 'Undefined property: Dashboard::$apiaccess' & 'Fatal error: Call to a member function viewAccount() on a non-object in'

If I just run the 'apiaccess' library it works great - the issue is having 2 libraries being loaded into this one function. Unsure what I have got wrong.

Any help would be great!
#2

[eluser]Unknown[/eluser]
Found the issue, I was extending the 'CI_Controller' in both my libraries which then of course would conflict.




Theme © iAndrew 2016 - Forum software by © MyBB