Welcome Guest, Not a member yet? Register   Sign In
php include vs libraries
#2

[eluser]skunkbad[/eluser]
If you use include, it is in a sense merging the included code. If you include a class, then you would use the "new" keyword to create an instance or object. That instance exists outside of the CI super object, so you can't easily use the same instance in a model if you instantiated it from a controller, or inside a library if you included it in a model, etc, etc. unless you pass the instance as a parameter when calling a method. It just creates spagetti code. If you loaded the class using CI, you'd be able to access the instance from anywhere that the CI super object is available. There may be other benefits of using CI to load, but that's the one that I think would be most important.


Messages In This Thread
php include vs libraries - by El Forum - 03-25-2012, 05:32 PM
php include vs libraries - by El Forum - 03-25-2012, 07:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB