[eluser]Dewos[/eluser]
[quote author="Phil Sturgeon" date="1259849739"]I STILL don't see the point here dude.
Code:
CI::library('session')->userdata('id')
$this->session->userdata('id')
It's longer!
What does this offer other than lazy-loading?[/quote]
Hi Phil,
Yeah, sometimes it's longer. In Codeigniter, this->load offers only normal-load resources as this simple plugin lazy-loading resources and give you the ability to use procedural resources on the fly (like CI::plugin('name')->do_some()). This's all.
Maybe you can think that is not worth the the effort, but defer initialization of an object until the point at which it is needed is far far far better that put Autoloading on ci's autoload.php (brrr) or in Controller::__construct (brr), or sometimes even on top on you code. If you think that you need certain resources globally throughout your application, in (many cases) you really DON'T.
Code:
## application/congif/autoload.php
$autoload['libraries'] = array('database','session');
## Controller
if ($action =='add')
{
//code
//code
$this->db->get('table');
//code
}
else
{
//code
//code
$this->session->set_userdata('action', 'some');
//code
}
Yes, you can check check check check check... everytimes that everything is loading in the most efficently way (but you're only a "maybe-check-fails" human

)... Or you can use this plugin.
By the way i'm open to discussion, so why can't you convert some of your scripts and see?