EllisLab text mark
Advanced Search
     
Working with packages
Posted: 29 February 2012 06:06 AM
Avatar
Joined: 2008-05-28
682 posts

Hi guys

I’m working on some code in CI I’d like to reuse in the future. After reading the docs and finding out about “packages” (http://ellislab.com/codeigniter/user-guide/libraries/loader.html) I thought it’d be interesting to bundle my reusable code in a package, but I find the docs a little lacking here and came across some problems.

I put my libraries, config files, views, core/MY_Controller and default controllers in a folder in the third_party folder. I’m autoloading the package and the libraries are working, though I’m stumbling across some problems:

- I’m using Colin Williams’ template library, but the config file isn’t loading, neither are the views. I am not certain this is a CI or Template library problem. 
- I got a 404 and had to put my default controller back in application/controller instead of application/third_party/app/controllers
- I’m overwriting CI_Controller with MY_Controller in application/core. I was hoping I could move this to the package as well, but no luck.

Are these problems that are easily fixable? Or am I trying to do something packages were not intended for?

 Signature 

Bramme.net webdevelopment
If I had a nickel for every time someone told me that my idea for melting down coins to make a giant robotic parrot was a bad idea, I would have one kicka$$ giant robotic parrot.

 
Posted: 16 March 2012 12:11 AM   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-09-02
24 posts

I’m trying to work through some of the same problems, so I’ll offer what I’ve found:

- It doesn’t look like config files from a package are loaded if those files exist in your application folder.

- As far as I can tell, core classes aren’t supported in the packages implementation. That’s something I’m currently wrestling with myself. It’d be pretty handy, though.

 Signature 

Bleh!

 
Posted: 14 June 2012 11:56 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-03-28
71 posts

I’m also finding the same problem. I can load libraries, helpers and models fine, but the config files are not loading.

The main one i want in the package is the database settings as I have two apps with the same database.php in each.

Any feedback or solutions would be much appreciated.