• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using class in model

#3
(04-21-2017, 04:34 AM)neuron Wrote: As I know $this  in library does not reference to CI, it references library class itself.


Thus in your code
$this->load within library

you need to get instance of CI
so instead of:

Code:
 $this->load->model('users_model');
try:

Quote:
PHP Code:
$CI =& get_instance();
$CI->load->model('user_model');

$CI->users_model->login_remembered_user(); 

For this in the user library is the following method:
PHP Code:
public function __get($var)
    {
        return 
get_instance()->$var;
    } 
Reply


Messages In This Thread
Using class in model - by -V1cu- - 04-21-2017, 04:19 AM
RE: Using class in model - by neuron - 04-21-2017, 04:34 AM
RE: Using class in model - by -V1cu- - 04-21-2017, 04:37 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.