CodeIgniter Forums
Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C (/thread-62387.html)

Pages: 1 2 3


Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - ukuser33 - 07-08-2015

I have the following code which produces a registration form. It works fine on the page load but on POSTing it tells me that CI_formgenerator cannot be found - even though I've clearly not called the function that. What am I doing wrong?

Code:
    public function index(){
        $this->benchmark->mark('code_start');
        
                $this->load->library('formgenerator',array('register'));

                $this->formgenerator->setupValidation();                        
                
                if ($this->form_validation->run() == FALSE){                                                
                        if (count($_POST)){
                                $this->formgenerator->populateForm($_POST);
                        } else {
                                $sample_data = array();
                                
                                $this->formgenerator->populateForm($sample_data);
                        }
                        
                        $form_out = $this->formgenerator->generateForm();
                        
                        $this->benchmark->mark('code_end');
                        $this->benchmark->elapsed_time('code_start', 'code_end').'<br>';
                        
                        $this->CI->autocontent['form'] = '<ul>'.implode($form_out).'</ul>'; // Autocontent can be an array of variables!
                } else {
                        $this->load->library('formgenerator',array('register'));
                        
                        $this->load->model('register');
                        
                        $this->register->saveUser($_POST);

                        echo 'Your registration has been successful. Please confirm your account in your email';
                }                                                                                
    }

The full error I get is:


A PHP Error was encountered

Severity: Error

Message: Class 'CI_Formgenerator' not found

Filename: core/Common.php

Line Number: 196

Backtrace:

{With no backtrace available}


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - Avenirer - 07-08-2015

There is no formgenerator library that comes with CodeIgniter (none that I know of...)


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - ukuser33 - 07-09-2015

No this is a library I've built myself & have added in.

Thanks


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - Narf - 07-09-2015

What do you have in your application/core/ directory?


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - ukuser33 - 07-09-2015

I don't have an application/core folder. According to http://www.codeigniter.com/user_guide/general/creating_libraries.html you put it in your application/libraries folder. I've tried to keep things as "standard" as possible so the location of the file is application\libraries\Formgenerator.php with the following start to my code:

Code:
class Formgenerator {
        
        private $form_output = '';
        
        public function __construct($form_name){
        $ci = get_instance();



RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - Narf - 07-09-2015

(07-09-2015, 10:42 AM)ukuser33 Wrote: I don't have an application/core folder. According to http://www.codeigniter.com/user_guide/general/creating_libraries.html you put it in your application/libraries folder. I've tried to keep things as "standard" as possible so the location of the file is application\libraries\Formgenerator.php with the following start to my code:


Code:
class Formgenerator {
       
       private $form_output = '';
       
       public function __construct($form_name){
       $ci = get_instance();

You do have an empty application/core/ directory by default ... if you don't, then you've manually removed it.

Anyway, as I said in a similar thread, calling $this->load->library() will never trigger the load_class() function (which is the one that has line 196 of system/core/Common.php), unless you've made modifications to the framework.


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - ukuser33 - 07-09-2015

(07-09-2015, 11:59 AM)Narf Wrote:
(07-09-2015, 10:42 AM)ukuser33 Wrote: I don't have an application/core folder. According to http://www.codeigniter.com/user_guide/general/creating_libraries.html you put it in your application/libraries folder. I've tried to keep things as "standard" as possible so the location of the file is application\libraries\Formgenerator.php with the following start to my code:



Code:
class Formgenerator {
       
       private $form_output = '';
       
       public function __construct($form_name){
       $ci = get_instance();

You do have an empty application/core/ directory by default ... if you don't, then you've manually removed it.

Anyway, as I said in a similar thread, calling $this->load->library() will never trigger the load_class() function (which is the one that has line 196 of system/core/Common.php), unless you've made modifications to the framework.



RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - ukuser33 - 07-09-2015

Ok so how should one call this library() function or is it just a bug/broken?


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - Narf - 07-09-2015

(07-09-2015, 02:30 PM)ukuser33 Wrote: Ok so how should one call this library() function or is it just a bug/broken?

It looks like you didn't quite understand me ... My point is exactly that the error you're getting has nothing to do with CI_Loader::library() and therefore could not possibly be a bug in the library loading logic.


RE: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C - InsiteFX - 07-09-2015

If you named your library CI_formgenerator then remove the CI_