Welcome Guest, Not a member yet? Register   Sign In
What are the best practices for loading a "library" without creating an object ("include?")
#1

[eluser]kirkryyn[/eluser]
While I appreciate the extra work CI goes through in order to attach a new instance of a library to the $CI object, sometimes I'd like to just create a one-time use instance or sometimes I may need several unique instances of the same class.

Is there a "lite" equivalent of load->library() that more or less acts just like include()? Or something that works like load->library() that returns an instance instead of attaching it to the $CI object?

I saw this thread which sounds sorta useful, except that it wastes and instance and pollutes my $CI object if I don't really want to put it there.

Are there some good ways to use require_once? Special path stuff I should take into consideration?

I'm pretty new to CI. All in all, I'm liking it so far. I had been afraid this was going to be another CakePHP experience....

The only thing I am not super excited about is having to think about everything being in the context of living in the $CI object. I'll do my best to play along with that philosophy, but it would help ease my mind if I knew that there is an option if I ever get into a bind. Smile


Messages In This Thread
What are the best practices for loading a "library" without creating an object ("include?") - by El Forum - 08-21-2009, 11:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB