[eluser]Bramme[/eluser]
Hey all,
I'm trying to extend the Loader library a little. I wanna add some functionality that will autoload libraries, EXCEPT for the ones you set in the autoload.php file.
I've got a fair idea of how to approach this, though I'm currently stuck with the following: for this trick to work I need to know what Controller the visitor is currently viewing, to check wether to load a certain library or not.
I've added this piece of code to the Loader library (offcourse in a MY_Loader class), in the _ci_autoloader method:
Code:
if (isset($autoload_exclude))
{
if (isset($autoload_exclude['libraries']))
{
foreach($autoload_exclude['libraries']['load'] as $item)
{
if (in_array($current_controller, $autoload['libraries']['exclude'])
{
$this->library($item);
}
}
}
}
Offcourse, $current_controller is not set, since I don't know how to get it. I've been digging a bit through the source code, and I suspect the code I need is either in the Router class, or the Controller class. But it's 0:30 am and I'm getting a tad confused.
I was hoping that, when I got up tomorrow, someone could've hinted me in the right direction, so I know where to look.
Thanks in advance!