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/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C (/showthread.php?tid=62387)

Pages: 1 2 3


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

My library isn't named CI_formgenerator. The question is how do I make this work? What have I done wrong? I need to call this code from my controller and the simple question is how do I do that?


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

It seems you are doing something wrong where you don't show. So nobody knows what's wrong.


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

There are four ways that this can happen:

- You've made modifications to system/core/
- You're overriding one of the framework's core libraries (which is why I asked you to tell what you have in application/core/)
- You're using a third-party plugin that does one of the above two conditions, but you're not telling us about it
- You're manually calling load_class('formgenerator') somewhere in your code


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

Hi there,

Here are the complete files minus my db config & the user checking db validation.

This should be ready to copy/paste and simply go to index.php/register to witness the problem. It works fine on the page load, not the page post.

Thanks

Antony


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

(07-11-2015, 02:10 AM)ukuser33 Wrote: Hi there,

Here are the complete files minus my db config & the user checking db validation.

This should be ready to copy/paste and simply go to index.php/register to witness the problem. It works fine on the page load, not the page post.

Thanks

Antony

Fix filename:
application/models/register.php -> application/models/Register_model.php

Fix code:
Code:
--- a/application/controllers/Register.php
+++ b/application/controllers/Register.php
@@ -48,9 +48,9 @@ class Register extends CI_Controller {
                 } else {
                         $this->load->library('formgenerator',array('register'));
                         
-                        $this->load->model('register');
+                        $this->load->model('register_model');
                         
-                        $this->register->saveUser($_POST);
+                        $this->register_model->saveUser($_POST);
 
                         echo 'Your registration has been successful. Please confirm your account in your email';
                 }       



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

(07-10-2015, 02:51 AM)Narf Wrote: There are four ways that this can happen:

- You've made modifications to system/core/
- You're overriding one of the framework's core libraries (which is why I asked you to tell what you have in application/core/)
- You're using a third-party plugin that does one of the above two conditions, but you're not telling us about it
- You're manually calling load_class('formgenerator') somewhere in your code

Truth is stranger than your expectation. :-)

In this case, a controller class was loaded as a model:
$this->load->model('register');

[Image: attachment.php?aid=277]


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

A big thanks for you guys who looked into this. Wierd error seeing as it never mentioned the model but thanks for finding it!


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

(07-11-2015, 04:18 AM)kenjis Wrote:
(07-10-2015, 02:51 AM)Narf Wrote: There are four ways that this can happen:

- You've made modifications to system/core/
- You're overriding one of the framework's core libraries (which is why I asked you to tell what you have in application/core/)
- You're using a third-party plugin that does one of the above two conditions, but you're not telling us about it
- You're manually calling load_class('formgenerator') somewhere in your code

Truth is stranger than your expectation. :-)

In this case, a controller class was loaded as a model:
$this->load->model('register');

[Image: attachment.php?aid=277]

Quite stranger indeed ... yet makes a lot of sense when you see it (2 violations of the file-class naming convention + a name collision).

Btw, this can only happen on case-insensitive file systems.


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

(07-13-2015, 12:59 AM)Narf Wrote: Btw, this can only happen on case-insensitive file systems.

Nope, same happens on my linux machine (ext4 partition)


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

(07-13-2015, 01:57 AM)gadelat Wrote:
(07-13-2015, 12:59 AM)Narf Wrote: Btw, this can only happen on case-insensitive file systems.

Nope, same happens on my linux machine (ext4 partition)

Maybe, but not if you've named the model 'register.php' instead of 'Register.php' like in this particular case.