Welcome Guest, Not a member yet? Register   Sign In
Global Library
#1

[eluser]newsun[/eluser]
I am looking to create some libraries to use across multiple applications and wondered if I can just create them in the CI->library directory like creating an app specific one?
#2

[eluser]jacobc[/eluser]
you can create them in the CI library directory...

I would tend to download the latest CI, and implement some libraries that I want to use in all my applications.

Then when you want to start a new app, instead of a fresh CI install... you use your CI + custom libraries instead.

If you have a server that hosts many of your apps, you might be able to do some symbolic linking to you own library folder that is used in all the apps.
#3

[eluser]Michael;[/eluser]
Greets Newsun,

There are 3 different places you can store libraries ... /application/libraries, /system/libraries, or /system/libraries/folder_name

The last option allows you to use multiple applications that use the same system folder and still have access to global or common libraries. Personally, I choose not to store them in /system/libraries/ because it makes upgrading just a tad bit more difficult; so I tend to use /system/libraries/common/ as my global hot spot.

Michael
#4

[eluser]newsun[/eluser]
How do you load the library in the /system/libraries/common/ directory or even in a sub-directory within?
#5

[eluser]Michael;[/eluser]
Greets,

$this->load->library('common/lib_name');

Simply, add the sub-folder name before the library name.

Michael
#6

[eluser]jedd[/eluser]
My money is on application/libraries - as it's part of the 'user' section of the CI directory structure. That is, the bit that you own and that CI upgrades tend to not step on the toes of.

Added bonus, you don't have to specify a path to load 'em.
#7

[eluser]Michael;[/eluser]
Jedd,

If you do not need to share a library across multiple applications then applications/libraries is the correct location, however that is not the case which we are discussing here.

Michael
#8

[eluser]jedd[/eluser]
Ah, my mistake, sorry. I misinterpreted the original post as how to use libraries across multiple CI application instances, rather than using libraries across multiple applications living within one CI instance. (I keep forgetting people actually do that! Wink)
#9

[eluser]Michael;[/eluser]
Jedd,

Is quite alright.

Michael




Theme © iAndrew 2016 - Forum software by © MyBB