Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 3 - Extending Form Validation not working
#6

(This post was last modified: 09-04-2015, 11:42 AM by mwhitney.)

(09-04-2015, 11:33 AM)ciadmin Wrote: MY_Form_validation should go in application/core if you are extending the built-in one.

That doesn't sound right. Since it's loaded via $this->load->library('form_validation'), the library() method would call _ci_load_library(), which, in turn, would call _ci_load_stock_library(), which eventually does this:

PHP Code:
        $paths $this->_ci_library_paths;

        array_pop($paths); // BASEPATH
        array_pop($paths); // APPPATH (needs to be the first path checked)
        array_unshift($pathsAPPPATH);

        foreach ($paths as $path)
        {
            if (file_exists($path $path.'libraries/'.$file_path.$library_name.'.php'))
            {
                // Override
                include_once($path);
                if (class_exists($prefix.$library_nameFALSE))
                {
                    return $this->_ci_init_library($library_name$prefix$params$object_name);
                }
                else
                
{
                    log_message('debug'$path.' exists, but does not declare '.$prefix.$library_name);
                }
            }
        


In general, when overloading system classes you just put the file in the equivalent directory in application. In other words, you would override /system/libraries/Form_validation.php with /application/libraries/MY_Form_validation.php
Reply


Messages In This Thread
RE: CodeIgniter 3 - Extending Form Validation not working - by mwhitney - 09-04-2015, 11:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB