Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined function get_instance()
#3

[eluser]tonanbarbarian[/eluser]
Yes there are a few things that are loaded before the controller
Once the controller is loaded a reference is made to the input class inside the controller so that you can access it there

If you need to extend the input and you need to access the controller in it here is what I suggest
still keep your CI property but do not instantiate it in the constructor

create a seperate method that can check for an instantiate the CI property and call there in any new code that you write where you might need to access the controller.
This way you dont break the input class and you only use the CI property when you needed it saving resources

Code:
class MY_Input extends CI_Input {
    var $CI = null;
    
    function My_Input()
    {
        parent::CI_Input();
    }

    function _inst() {
      if ($this->CI===null && function_exists('get_instance'))
        $this->CI =& get_instance();
    }

   function something() {
     $this->_inst();
     ...
   }
}


Messages In This Thread
Fatal error: Call to undefined function get_instance() - by El Forum - 12-13-2007, 05:50 AM
Fatal error: Call to undefined function get_instance() - by El Forum - 12-13-2007, 08:20 AM
Fatal error: Call to undefined function get_instance() - by El Forum - 12-13-2007, 02:05 PM
Fatal error: Call to undefined function get_instance() - by El Forum - 12-13-2007, 04:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB