[SOLVED] 'Unable to locate file: mi_model.php' using HMVC |
[eluser]DooBie[/eluser]
Hi, i am get same error when i try to view any page if a try to load a model in a controller class. I have this structure: Code: +app_SNR (application folder) Code in modules/usuarios/controllers/usuarios.php Code: class Usuarios extends Controller Code in modules/usuarios/models/usuarios_model.php Code: class Usuarios_model extends Model I put an example (sorry my poor english) If i go to http://miserver/usuarios i ger this error: Code: An Error Was Encountered BUT, if i put the usuarios_model.php file in 'app_SNR/models' AND put in 'autoload.php' Code: $autoload['model'] = array('Usuarios_model'); Code: ... WORK'S perfect! Where's my error? Thank you very much
[eluser]ivaylok[/eluser]
The problem is that when you use CI's load->model method as you said, it is trying to locate the usuarios_model.php in your models folder, inside your application folder(so in your case it is trying to locate it in app_SNR/models/ ). So you should probably be extending CI's Loader library (you can do this unless using php4) and creating your own model function, that suits your folder structure.
[eluser]DooBie[/eluser]
First of all, thanks, but, i use HMCV library, and in his documentation said the models folder in modules are viewing by the system, is not need to put the models in app_SNR/models. And second, if i put the file usuarios_model.php in app_SNR/models folder, i have the same error, only work if put in autoload.php file!!!! this is the problem!
[eluser]DooBie[/eluser]
i solved my problem, the error are in this line in usuarios.php: Code: $this->load->model('Usuarios_model'); i change with this line: Code: $this->load->model('usuarios_model'); Note that 'usuarios_model' are in first lowercase! but, the name of the class are 'Usuarios_model' with first upercase. Thanks!
[eluser]Unknown[/eluser]
Doobie muchas gracias! tu solución me sirvió para librarme del mismo error que me tenía loco desde hace 3 horas. --- Thank you Doobie! Your solution helped me to track the error.
[eluser]gvillavizar[/eluser]
Wow, a mi tambien me sirvio. Llevo un buen tiempo tratando de solucionar esto y no habia podido, increible que una simple letra mayuscula pudiera tenerme trancado por dos dias con el mismo error. Gracias! Edit: Ok, todavia no. Sigo teniendo el problema, estoy haciendo un clean install a ver si asi lo resuelvo. Edit: Efectivamente, eso resolvio mi error. Gracias. |
Welcome Guest, Not a member yet? Register Sign In |