Welcome Guest, Not a member yet? Register   Sign In
Loading just about anything is not working correctly
#1

[eluser]Unknown[/eluser]
The environment is using 1.7.2.

First things first, I've extended the form_validation library according to the user guide:
Code:
class MY_Form_validation extends CI_Form_validation {


    function MY_Form_validation() {
       parent::CI_Form_validation();

        log_message('debug', "MY Form Validation Class Initialized");        
    }

   /**
    *
    */
   function set_error($key, $message) {
      $this->_field_data[$key]['error'] = $message;
      $this->_error_array[$key] = $message;
   }
}


This is placed in the application/libraries directory just as I have done numerous times before. However, I get "Fatal error: Call to undefined method CI_Form_validation:Confusedet_error()". I've check the config file and verified that "MY_" is the prefix for custom classes and the my file name is also properly formatted.



Second, and the reason for the topic, is that EVERY model, library or help must load in the constructor of the controller. This is a regression as I've brought over code from other projects where I will load $this->load->model('user_model'); on the functions that are specific to users. IE when I try to load this in my "function add_user()" page and call $this->user_model->insert_user($data) I get the error that "Call to a member function insert_user() on a non-object". I've found that if I do $ci =& get_instance() and load the model from there in the function that it works. Help!?




Theme © iAndrew 2016 - Forum software by © MyBB