Welcome Guest, Not a member yet? Register   Sign In
Including Classes using CI Loader [Modules etc]
#1

[eluser]wiredesignz[/eluser]
I'm probably going to get some flak for this, but it is possible to include() your class definitions, be they modules, libraries or whatever, in CI Loader without hacking the core.

Create: application/libraries/MY_Loader.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_Loader extends CI_Loader
{
    //do nothing here!
}

function load_module($module = '', $params = NULL)
{
    include(APPPATH.'modules/'.$module.EXT);
    return new $module($params);
}
You can then load them as needed in your application: $this->menu = load_module('menu');

Any thoughts on this would be appreciated. Good or Bad.




Theme © iAndrew 2016 - Forum software by © MyBB