Welcome Guest, Not a member yet? Register   Sign In
CI case-sensitivity
#1

[eluser]Tri Dang[/eluser]
Hello everyone,

First, I must say that CI is very good for me. I use it now and then for my not-very-small web sites development. Thanks for the great product.

I have a concern about case-sensitivity (sorry, English is not my native language) of CI that I think you guys may point me to the right direction. The problem is:
-I known that CI use Camel for class names and lower_case for file names. So, if I have a model My_model, I will store it in my_model.php. To use it in my controllers, I can use either: $this->load->model('My_model') or $this->load->model('my_model') (notice the first character 'm'). But after loading, I must use the correct name with case-sensitivity. What is your prefer way of load? Class name or file name? I known that each one may have a prefer way, so I just want to see what is used more.
-But there is an exception to the above rule, that is when I load
Code:
$this->load->library('Form_validation');
  if($this->Form_validation->run() == FALSE)
  ...
I always get "Fatal error: Call to a member function run() on a non-object". But the error is not happen when I used
Code:
$this->load->library('form_validation');
  if($this->form_validation->run() == FALSE)
  ...
that means file name is prefer than class name for core library? or if I misunderstand something about CI?

Thanks in advance
#2

[eluser]Tri Dang[/eluser]
I just want to pull this thread up in case someone may give some advice.
#3

[eluser]xwero[/eluser]
I have no problem calling the all lowercase form_validation object.
#4

[eluser]Tri Dang[/eluser]
[quote author="xwero" date="1232458869"]I have no problem calling the all lowercase form_validation object.[/quote]

Yes, I don't have any problems calling the lower case version of it either. Only the upper case that causes error.

I don't know why I can call using both ways (upper case and lower case) for my created components (for example, my models), but I can't call this library using the upper case?

Thank you
#5

[eluser]xwero[/eluser]
sorry i have to keep my eyes open when i read Smile

I think for consistency you should call all your objects in lowercase. Maybe CI should enforce this?

But you are right it's an inconsistency in the calling of objects.
#6

[eluser]Tri Dang[/eluser]
[quote author="xwero" date="1232466036"]
I think for consistency you should call all your objects in lowercase. Maybe CI should enforce this?
[/quote]
Yes, I totally agree with you on this.
At first, I created my own rule to call all models, library etc... using class names (I have a small team of 3 developers including me). That is Upper_lower format. Then I met form_validation Sad. I don't want to change my rule and all my existing code.

Anyway, I had to change my rule since then.




Theme © iAndrew 2016 - Forum software by © MyBB