We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Using CodeIgniter Libraries in an EE Extension?

Development and Programming

Jason McCallister's avatar
Jason McCallister
255 posts
15 years ago
Jason McCallister's avatar Jason McCallister

I am in the process of planning and writing my first add-on and I have some specific goals that can be easily accomplished using some of the CI Classes that are provided.

My first REAL question is utilizing the CI Libraries. With 2.0 being built on the CI framework does that mean we have complete access to every lib provided by CI?

So if I wanted to use the User Agent Class I could simply use this to call it in my Extension?

$this->load->library('user_agent');

With that being said, I am a complete n00b to writing add-ons and look forward to this. CI made ALOT more sense to me than the EE 1.x code for add-ons. Hopefully this will be enjoyable. 😉

       
Christopher Imrie's avatar
Christopher Imrie
57 posts
15 years ago
Christopher Imrie's avatar Christopher Imrie

Hi Jason, You are exactly right. Anything that was available in CI is available in EE. The one thing to realize though is that EE is overriding a lot of the base CI classes (like the way routing works for example), but this doesnt stop you from re instantiating them for your own use.

I am the same as you with regards to 1.6 v 2. I didnt like the way the addons worked with 1.6.x, but still managed to crank out a few for client use. Having come from a CI background though, as soon as EE migrated to CI, I could finally bend EE to my will and I started seeing what out could do with CI and EE side by side (this is my latest here: http://devot-ee.com/add-ons/remote-file-browser/ )

The only thing which took me a little getting used to, coming from CI, was that everything is part of an EE super object. So instead of:

$this->load->library('user_agent');

It is actually done like this:

$this->EE->load->library('user_agent');
       
Eric Barnes's avatar
Eric Barnes
487 posts
15 years ago
Eric Barnes's avatar Eric Barnes

Just to add to this besides the EE super object being tricky even though EE 2.1 is php 5 only you still can’t use __construct in some of your class files. (mod file, plugin, etc.) That one throw me.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.