Welcome Guest, Not a member yet? Register   Sign In
Is Codeigniter case sensitive?
#1

[eluser]Unknown[/eluser]
Is Codeigniter case sensitive? For example I load a library:
this->load->library("TEST") with the library name all capitals and then, can I use this->test->dummy with the "test" all low cases?
#2

[eluser]CroNiX[/eluser]
Look at the loader class. It's not consistent. Some will search for the name as is and if it doesn't find it it checks to see if a lower-cased version exists and loads that if it does.

Personally, I write filenames that I create in all lower-case, except when extending a core class with MY_
I define classes with upper-case first letter (class Some_class extends CI_Controller)
When using the loader, I always use lower-case ($this->load->library('test'))
When referencing something that has been loaded, I always use lower-case ($this->test->some_method())

And never have any problems, regardless of operating system.
#3

[eluser]Unknown[/eluser]
Thanks for your quick reply.
Actually I am looking at somebody's PHP code which is using Codeigniter, and I find he uses
this->load->library("Test") and latter on he uses this->test->dummy to call the "Test" library. I just want to confirm if the "Test" loaded library is the same as the called "test".

Thanks again.
#4

[eluser]PhilTem[/eluser]
If you took a closer look at the CI core (mainly the loader-class), you will find this line of code

Code:
// Set the variable name we will assign the class to
// Was a custom class name supplied?  If so we'll use it
$class = strtolower($class);

which implies that everything in CI is accessed by $this->lowered_class_name and nothing else. Following the naming conventions for libraries, controllers, and models would also never make a

Code:
$this->load->library('UPPERCASE_Library');

possible, since it should be avoided using the CI naming convention (cannot find the link at the moment)




Theme © iAndrew 2016 - Forum software by © MyBB