Welcome Guest, Not a member yet? Register   Sign In
Loading Library from models work for CI Libraries not for Custom Library?
#1

[eluser]bunal[/eluser]
Hi Coders,

I am trying to access a custom library from the model.


When using the following code in the constuctor of the model it WORKS.
CI's Library loaded and method called in success

Code:
$CI =& get_instance();
$CI->load->library('email');
$CI->email->clear();

But when i try to load a custom library and try to access it method it gives ERROR(Call to a member function )
When the following code runs i know the custom library loads because there is a "Echo" statement in the constructor of the custom library.But the method is not called. It gives error

Code:
$CI =& get_instance();
$CI->load->library('MyLib');
$CI->MyLib->clear();

Any solutions to this problem?
#2

[eluser]Maglok[/eluser]
Have you tried case sensitivity?
#3

[eluser]bunal[/eluser]
Well i found the problem. But i have another one now.

My Library (Aca_user) loads model in constructor

Code:
$this->CI->load->model("Aca_user_model");

And My Model(Aca_user_model) loads library in constuctor.

Code:
$CI =& get_instance();
$CI->load->library('Aca_user');
$CI->Aca_user->clear();

Thats is creating a loopback and causing problem?

Anyone know to fix this?




Theme © iAndrew 2016 - Forum software by © MyBB