Welcome Guest, Not a member yet? Register   Sign In
Library call within a Library


I have a Library I use to parse data located at .../application.libraries/MYParseClass.php

This class has a require() call in it for another class that is needed to do a certain task in MyParseClass.

How do I set this up so MyParseClass can use this child-helper library?


UPDATE: Looks like the obvious and simple solution works. I added this to the top of my application/libraries/MYParseClass.php file...

Only question is, is this the proper way to do this sort of thing in CI?

I think the question is, "is this a supporting class only, or can it stand by itself?" If it's a supporting class only, you can probably just stick the class code in the same file. CI's loader will only load the class by the same name (as the file.) Otherwise, I think calling require_once() is fine.

If you want to use the loader class, you can get an instance of CI in your parent class.

class {
public $ci;
function __contruct()
$this->ci =& get_instance();

Theme © iAndrew 2016 - Forum software by © MyBB