• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class 'CI_Formgenerator' not found in C:\Users\mycode\system\core\C

#11
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?
Reply

#12
It seems you are doing something wrong where you don't show. So nobody knows what's wrong.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#13
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
Reply

#14
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


Attached Files
.zip   problemsite.zip (Size: 689.1 KB / Downloads: 84)
Reply

#15
(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';
                 }       
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#16
(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]


Attached Files Thumbnail(s)
   
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

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

#18
(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.
Reply

#19
(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)
Reply

#20
(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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.