I’m not sure if this is possible, but various posts in the forums here and in the documentation suggest that I should be able to let EE know what’s going on in the CodeIgniter foundation that it’s built on.
So, in light of that, I’ve got a CI app (with a specific custom library I need), and an EE site. The /system directory is structured like this:
/system
/system/codeigniter
/system/codeigniter/application (this is my existing CI app)
/system/codeigniter/system (this is the same CI folder that EE runs from)
/system/expressionengine
... (this is the normal EE - templates, add-ons, etc.
My understanding was that I could use this setup to built an EE module that would integrate well with CI.
Currently, I have a module setup based on the EE module dev tutorial, and a method in it that does this, just as a starting point:
function __construct()
{
$this->EE =& get_instance();
$this->CI =& get_instance();
$this->auth =& $this->CI->load->library('mylibrary');
}But then it doesn’t recognize the library when I load the module (this is all happening inside the EE control panel, at this point, just so I can make a connection between the two). Says the library doesn’t exist. Is there anything I can do to make this connection, or am I going the wrong direction entirely?
Thanks, Jonathan
Hi AirWatch,
It’s my understanding that the instance of CI that you are calling would be the one included with ExpressionEngine, not your application. Essentially your instance of CI isn’t being loaded because the index.php file that loads that app isn’t being called. Therefore, since your library lives in your app, and you are calling ExpressionEngine’s CI instance, the library isn’t being loaded.
We aren’t setup to provide developer related questions in the support forums, so in an effort to get you an answer, I’m going to move this into Development and Programming. The Community there might be able to shed some light on this for you.
Cheers!
EE and your module don’t know at all about your system/codeigniter/application folder. Try this, it might work:
$this->EE =& get_instance();
$this->EE->load->add_package_path(BASEPATH.'../application/');
$this->EE->load->library('mylibrary');
$this->EE->mylibrary->do_stuff();@Rob, this seems like it’s in the right direction. It now loads the library from the application folder just fine, but it does throw an error (Unable to load the requested language file) about a missing language file associated with the library. I verified that the language file is present (application/language/english/).
Is this something you might be able to speak to, as well?
Many thanks.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.