CI Way of Using Own Classes / Code |
Hello. After searching, reading the CI docs, looking at several online CI project examples and a number of github projects I can't figure this out.
What is the CI best practice to use for our own 'independent' classes and code in relation to CI's structure? I can only find relevant info from examples in "Creating Libraries" I see Code: $this->load->library('someclass'); I'm used to thinking of libraries as external code that comes in some "name.lib" format or, with PHP, like these: http://tutorialzine.com/2013/02/24-cool-...now-about/ I don't think of my own code as a library. I like bifurcating using 'Separation of Concerns.' Yet, I do not see any example of anyone 'new'ing' classes like in the code snippet below. (Note my question is general, not just about models.) I've tried the (equivalent example ) code below in a working program; it works. Is it a bad practice to do that? Code: <?php I think I understand to get 'native' access to CI functions, et cetera, I may have to make a class a library class. Is it bad practice to pass a reference to $CI into a non-CI derived class? Thank you. |
Messages In This Thread |
CI Way of Using Own Classes / Code - by JustBoo - 02-17-2017, 10:41 AM
RE: CI Way of Using Own Classes / Code - by Shawn - 02-18-2017, 09:58 AM
RE: CI Way of Using Own Classes / Code - by JustBoo - 02-19-2017, 11:49 AM
RE: CI Way of Using Own Classes / Code - by marksman - 02-19-2017, 01:58 PM
RE: CI Way of Using Own Classes / Code - by codevil - 08-22-2019, 12:04 AM
|