Problem Loading MY_Model |
[eluser]kirkaracha[/eluser]
I'm running multiple applications under CodeIgniter 1.7.2 based on the user guide instructions, and I'm having trouble loading an extended model. I'm autoloading the Active Record and Database libraries. Here's my trimmed-down directory structure: /codeigniter/ <- renamed "system" /codeigniter/application/my_application/controllers/test.php <- controller /codeigniter/application/my_application/models/test_model.php <- model /codeigniter/application/my_application/libraries/MY_Model.php <- extended model Here's test.php: Code: <?php Here's test_model.php: Code: <?php Here's MY_Model.php: Code: <?php The test controller works fine if I go to it without loading any models, and if I load the test model without trying to load the extended model. If I try to load the extended model, I get this error: "Fatal error: Class 'MY_Model' not found in /codeigniter/application/my_application/models/test_model.php on line 3" What am I doing wrong? Bonus question: could I move MY_Model.php to /codeigniter/libraries/ and use it in all my applications?
[eluser]imn.codeartist[/eluser]
Check your code Code: <?php
[eluser]John_Betong[/eluser]
Try this: Code: <?php edit: Renamed function to MY_Model
[eluser]Phil Sturgeon[/eluser]
Strange error there, that should work. Quote:Bonus question: could I move MY_Model.php to /codeigniter/libraries/ and use it in all my applications? That should work fine. I would suggest moving it anyway, might solve this weird error. |
Welcome Guest, Not a member yet? Register Sign In |