Welcome Guest, Not a member yet? Register   Sign In
Models in subdirectories
#1

[eluser]Kumar Chetan sharma[/eluser]
Hi,

Is it possible to put models inside a subdirectory? I am trying to do some thing like following:
models/
models/mymodels/
models/mymodels/user.php {contains Model_user.php with class Model_user extends Model}

controller/
controller/user.php with adduser method.
Now how do I load the Model_user model? If I do
Code:
$this->load->model('User_model','', TRUE);
or
Code:
$this->load->model('mymodels/User_model','', TRUE);
I get "Unable to locate the model" error.
#2

[eluser]xwero[/eluser]
The file name should be the same as the class name. Or you have to load it like this
Code:
$this->load->model('mymodels/user','', TRUE);
$this->user->model_method();
#3

[eluser]Kumar Chetan sharma[/eluser]
thanks a ton, it helped me :-)




Theme © iAndrew 2016 - Forum software by © MyBB