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

[eluser]wiredesignz[/eluser]
Quote: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?
Yes there is.

You might try using the core function "load_class()", although you are required to use the CI_ class prefix if you require the class instantiated, it does not require CI_ prefix, and will not instantiate the library with FALSE as the second parameter.

Code:
load_class('Custom_lib', FALSE);

Alternatively you might consider using the plugin convention. Plugins are loaded but not instantiated. Probably more appropriate than as a helper.


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



Theme © iAndrew 2016 - Forum software by © MyBB