How to store models in folders

I have 3 separate portals and do not want to mix all models in one folder. I tried to split the models into 3 separate folders, but this did not work. Codeigniter went on to say that no models were found. I even tried

$this->load->model('folder_path/my_model'); 

I'm currently doing this, for example (admin, members and public)

 admin_my_model members_my_model public_my_model 

Will there be another method?

+4
source share
2 answers

CodeIgniter supports a single subfolder under models like this:

 $this->load->model('admin/my_model'); 

should work (where admin is a subfolder of the CI models directory). Be sure to specify only the relative path from the folder with your models (so that not the full path is completely from your CI installation).

See also: http://ellislab.com/codeigniter/user-guide/general/models.html#loading

+2
source

create the modules folder in the application folder. then under the modules create the members folder for the member module. in the participants folder it will contain 3 folders

 1) controllers (will contain member.php controller) 2) models (will contain members_model.php model) 3) views (will contain members_view.php view) 

then load your model as follows

 $this->load->model('members/members_model'); 
0
source

All Articles