Welcome Guest, Not a member yet? Register   Sign In
CI 2.x->3.x Class Names?
#1

I'm upgrading from CI 2.x to 3.x.  I see that I will be changing the case of class names to make them have initial caps. E.g.:

PHP Code:
application/libraries/mylibrary.php 

becomes:

PHP Code:
application/libraries/Mylibrary.php 

Question: do I also need to update references to that class in the code? E.g. do the following need to change as well?

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

$this->mylibrary->myfunction(); 

...or, can I leave those unchanged?

Thanks in advance for the info
Reply
#2

(This post was last modified: 11-11-2016, 11:47 AM by Wouter60.)

You can leave those in lower case.
But you do have to rename the classes inside the corresponding php files.

So the file Mylibrary.php must start with:

PHP Code:
<?php
class Mylibrary 
Reply
#3

Excellent. Thanks very much.
Reply
#4

(11-11-2016, 11:33 AM)Wouter60 Wrote: You can leave those in lower case.
But you do have to rename the classes inside the corresponding php files.

So the file Mylibrary.php must start with:

PHP Code:
<?php
class Mylibrary 

Should, but not really required. It will work just fine with renaming only the files.
Reply
#5

http://www.codeigniter.com/user_guide/ge...ile-naming
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB