Welcome Guest, Not a member yet? Register   Sign In
Noob-Question about subclass prefix
#1

[eluser]Unknown[/eluser]
Hello,

i started just one houre ago with CI. I have little problem at the Section "Creating Libraries" at "General Topics".

Creating the MY_email.php with following code

Code:
class MY_Email extends CI_Email {

    function My_Email()
    {
        parent::CI_Email();
    }
}
does not work. The given Error-Message is
Code:
class MY_Input extends CI_Input { function My_Input() { parent::CI_Input(); } }
Fatal error: Class 'MY_Input' not found in C:\xampp\htdocs\CodeI\system\codeigniter\Common.php on line 123

Why is that happen if i use
Code:
$config['subclass_prefix'] = 'MY_';
?

Thanks
Peter
#2

[eluser]xwero[/eluser]
Did you put the class in the application/libraries directory?
#3

[eluser]Unknown[/eluser]
yes,...
#4

[eluser]esra[/eluser]
The capitalization of the class name and constructor method name should match. As a general rule, I usually match the capitalization of the filename with the class name and this may be an issue since you are extending a system library.

However, the error message regards not finding MY_Input.php which would be an extended version of the Input library. Does MY_Input.php exist in application/libraries/? It seems like the problem has nothing to do with the extended Email controller since common.php contains the class loader for the front controller (CodeIgniter.php) where the error was detected. That is Common.php is required by CodeIgniter.php. The class loader in common.php is used to load a number of classes required by the front controller that reside in system/libraries/, was well as any classes loaded via hooks. One of these libraries is Input.php. Thus, the error appears to be generated during the front controller startup sequence and before the extended Email controller is loaded. It could be that you have a class name or file name mismatch for MY_Input.php.




Theme © iAndrew 2016 - Forum software by © MyBB