Welcome Guest, Not a member yet? Register   Sign In
Adding simple class
#7

[eluser]BizComputing[/eluser]
xwero, I just realized I read into your answer, when you said include, I assumed you were refering to using load->library(). If that were the case, then my previous post applies. As well as the arguments I stated there there is also the issue of having the waste of an unused instance.

I see now that you were most likely talking about using the php include or require directive right within the controller.

Yes, that would work, but, aside from "not looking nice", it goes against the spirit of CI where CI is able to track and manipulate all the code resources you utilize.

Nick Husher's suggestion of packaging the class as a helper would also work since helpers are simply loaded rather than instantiated. My dislike for this idea though is the confusion it brings. CI makes the distinction that a helper is procedural so coding a class def within a helper may work, it is not intuitive. His other suggestion of "tail gating" a model or controller once again would work, but again leads to confusion.

I develop large custom applications where we are making the transition to building on CI. I realize that there will be places I will have to do things in a less than desirable way, but the more I can keep to the CI spirit, then, the cleaner and easier to follow my code becomes and with all the expansion and maint I have to constantly do, clean code will be a Godsend.


Messages In This Thread
Adding simple class - by El Forum - 01-28-2008, 11:17 AM
Adding simple class - by El Forum - 01-28-2008, 12:55 PM
Adding simple class - by El Forum - 01-28-2008, 01:19 PM
Adding simple class - by El Forum - 01-28-2008, 01:22 PM
Adding simple class - by El Forum - 01-28-2008, 05:16 PM
Adding simple class - by El Forum - 01-28-2008, 06:40 PM
Adding simple class - by El Forum - 01-28-2008, 07:00 PM
Adding simple class - by El Forum - 02-05-2008, 09:04 PM
Adding simple class - by El Forum - 02-11-2008, 12:42 AM
Adding simple class - by El Forum - 02-11-2008, 02:10 AM
Adding simple class - by El Forum - 02-11-2008, 05:06 AM
Adding simple class - by El Forum - 04-13-2008, 11:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB