Constructor Help |
[eluser]bunoire14[/eluser]
Hi Guys, hope this is the right place to post, I have an issue when trying to load a model from within the class constructor, it doesn't throw any errors but just gives me a blank page. Am i doing something incorrectly? Code: function __construct() Any help greatly appreciated!
[eluser]danmontgomery[/eluser]
Have you checked the apache error log for PHP errors?
[eluser]fesweb[/eluser]
You need to get the CodeIgniter super-object first... Code: function __construct() From the user guide: Quote:Note: You'll notice that the above get_instance() function is being passed by reference:
[eluser]InsiteFX[/eluser]
If he is loading the model from the controller he doe's not need to use the CI Superobject! If he trying to load it in a library etc then yes he will need the CI Superobject. InsiteFX
[eluser]fesweb[/eluser]
InsiteFX: Right - I missed that part since he was loading another model...oops...
[eluser]joakley77[/eluser]
Have you already checked to make sure you named the model correctly? I've been known to forget to correctly name the model controller before. IE [code] <?php // application/models/user_model.php class User_model extends CI_Model { // constructor/methods/etc } ?>
[eluser]InsiteFX[/eluser]
Here is a tip for all new users: Code: // use this at the top of all your controllers libraries and models. InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |