CodeIgniter Forums

Full Version: Best Pratice
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hello Peeps.

Just looking for some advice.

Using the MVC pattern when would you want to use the libraries folder.

Im trying to get my head around the need for this folder.

Can you explain a good reason to use it.

Hope you can advise.

El Forum

[eluser]Pascal Kriete[/eluser]
It's most commonly used for actions that you need more than once, so that you don't have any duplicate code in various controllers.

CI already has most of the libraries a normal application requires, but for more complex situtations you'll find yourself in need of some extra functionality. Take a look through the ignited code section, a lot of the stuff that gets posted there are libraries.

Hope that answered your question.

El Forum

Great thanks.

Just thinking about what you said about it being able to share actions makes sense as you would not share a component.

Thats great thank you.

El Forum

a good example to follow for you is /system/librairies, those are some of the core libs, don't be surprise to see that your own could be pretty much similar.

see ya around.