Trouble loading model |
[eluser]nathj07[/eluser]
Hi, I'm new to the CI framework but so far so good. I'm currently working on a simple proof of cncept thing to write some form information to a database. With a background in Java I am keen to keep to the MVC way of doing things and so I have created a MY_Controller and a MY_Model. Both of these extend their CI_ counterparts and exist in application/core directory. The MY_Controller class seems just fine. So all my controller classes extend MY_Controller and this works just fine. I have sketched the early beginnings of a model class within the application/models directory and am attempting to load this in a controller. However, the load line causes a 500 Internal Server error. Here is the code for the 2 custom model classes: MY_Model Code: <?php (defined('BASEPATH')) OR exit('No direct script access allowed'); The news_model class (snippet): Code: <?php Code: class News extends MY_Controller This is really annoying me now as I cannot figure out how to do it. Any help on this would be greatly appreciated. Many thanks Nathan
[eluser]nathj07[/eluser]
Hi, I'm running IIS7 and the log simply reports Internal Server error: 2011-03-29 14:36:23 ::1 GET /index.php/news - 99 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:2.0)+Gecko/20100101+Firefox/4.0 500 0 0 51 So that doesn't shed any light on it for me. I was hoping that would show something wrong with my PHP but alas nothing that straight forward. Any other ideas? Thanks Nathan
[eluser]nathj07[/eluser]
Thanks for that. When we move to a live environment it will be Apache based. But as I am developing on a Windows box IIS7 is the easiest thing to set up and get running. So apart from 'change the hardware, change the software or change the web server' are there any other suggestions? Many thanks Nathan
[eluser]sirfilip[/eluser]
Well i have copy pasted your code (the models part) into my ci installation and it worked no error was thrown. How ever it is not an codeigniter problem cause if it was it would throw an error. The server error that you are receiving could be caused by the IIS. The best way to check is by installing wamp http://www.wampserver.com/en/ it is free and one click install away, and try your code there. Dont forget to free the port 80 (turn off your IIS) before you try to start apache.
[eluser]nathj07[/eluser]
Hi, I meant to come back here sooner and say that I had figured out it was not a CI issue. I scrapped the code and started again and I have it working so there was something in the config somewhere that was not right. Anyway thanks for the help and the advice, I may yet install WAMP. The issue I have is that I am already running Apache on port 90 to serve SVN to the team (there's only 2 of us). Cheers nathj07 |
Welcome Guest, Not a member yet? Register Sign In |