Adding simple class |
[eluser]Seppo[/eluser]
To simple include a file you can use $this->load->file method.
[eluser]nocash[/eluser]
You're right, the autoload function is the way to go. I wasn't writing any code for a while but I looked into once I started up again and I've been using it since. And for anyone that doesn't know, info on the autoload function can be found here. I've just been making an autoload_helper.php file that contains the code below, then include the helper in autoload.cfg. It seems to work out pretty well. Hopefully that's not abuse of a helper. Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); The reason for the first if statement is because I noticed a lot of native CI classes were running through my autoloader. I'm not sure what's up with that, but CI works just fine without this function's help so I put that in there. So, I know this thread is a bit dated now, but I wanted to put this out here in case someone starting out finds it useful. |
Welcome Guest, Not a member yet? Register Sign In |