07-13-2009, 07:25 PM
[eluser]ntheorist[/eluser]
in the Controller, or Controller extending class :
i realize automagic php functions can be overused and not so great performance-wise, but this might work as an alternative to the autoload config. The only thing is this only loads libraries, but those tend to be the bulkiest parts of an app and would call it up only when needed. Sure its easy just to write $this->load->library() but i'm lazy!
n
in the Controller, or Controller extending class :
Code:
function __get($name)
{
// Return return value
if (isset($this->{$name})) return $this->{$name};
// Will exit if not found
$this->load->library($name);
return $this->{$name};
}
i realize automagic php functions can be overused and not so great performance-wise, but this might work as an alternative to the autoload config. The only thing is this only loads libraries, but those tend to be the bulkiest parts of an app and would call it up only when needed. Sure its easy just to write $this->load->library() but i'm lazy!

n