CodeIgniter Forums
class_exists unusable - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: class_exists unusable (/thread-41043.html)



class_exists unusable - El Forum - 04-26-2011

[eluser]Unknown[/eluser]
I was building a class "setting" to use "const",and I put in the "application/config" directory, but when executing Setting:: they have error Fatal error: Class 'Setting' not found in D: \ appserv \ www \ news \ application \ controllers...
Please help me!


class_exists unusable - El Forum - 04-26-2011

[eluser]Nick_MyShuitings[/eluser]
Unless you require that class, your code does not know it exists. You could perhaps put it in the autoload array?


class_exists unusable - El Forum - 04-26-2011

[eluser]danmontgomery[/eluser]
Nothing in the application/config directory is expected to be a class.


class_exists unusable - El Forum - 04-26-2011

[eluser]Nick_MyShuitings[/eluser]
True. The CI way to do functions like that is usually to create and load a helper. However if he wants to break out of the mold all he would need to do is require the file and he can use the static functions as he wants.


class_exists unusable - El Forum - 04-26-2011

[eluser]toopay[/eluser]
And...where is the bug?


class_exists unusable - El Forum - 04-26-2011

[eluser]Unknown[/eluser]
I'm still fine in version 1.73, at version 2,02 -> failed, i move it to directory "libraries" and set autoload, rename class Setting -> My_Setting does not error message again