Welcome Guest, Not a member yet? Register   Sign In
__get in libraries
#5

well if your talking about accessing ci super object (for a lack of better term) form a class file in the libraries folder then the standard practice and imho best and easiest way to do it is like this:

Code:
class Someclass
{
 private $ci;

 function __construct()
 {
     $this->ci = get_instance();      
 }

 function do_something()
 {
     return $this->ci->config->item('uri_protocol');
 }
}
"I reject your reality and substitute my own" - Adam Savage, M5 Inc.
Reply


Messages In This Thread
__get in libraries - by kylevorster - 12-11-2014, 02:21 AM
RE: __get in libraries - by Rufnex - 12-11-2014, 09:28 AM
RE: __get in libraries - by mwhitney - 12-15-2014, 10:11 AM
RE: __get in libraries - by Narf - 12-16-2014, 12:22 PM
RE: __get in libraries - by Hobbes - 12-20-2014, 05:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB