CodeIgniter Forums

Full Version: Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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?
It seems you are doing something wrong where you don't show. So nobody knows what's wrong.
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
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
(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';
                 }       
(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]
A big thanks for you guys who looked into this. Wierd error seeing as it never mentioned the model but thanks for finding it!
(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.
(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)
(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.
Pages: 1 2 3