CodeIgniter Forums

Full Version: When should I use a library [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]katimari[/eluser]
Hi everyone - I'm only a week into working with CodeIgniter and have a pretty basic question. I have a controller that has some functions that I want to be accessible through a URL and some functions that I do not want to be accessible to the public.

Should I be creating a library for the functions I don't want the public to access or is there a better way to handle this?

Thanks for your help!

El Forum

[eluser]Mischievous[/eluser]
Normally I use libraries when I don't need to access to any CI resources to get the job done. Otherwise I run with a model. But I believe I would keep all the functions or "thinking" to a model and just let the controller hand off the request to a model and then retrieve it and send it to a view.


\/-------------------
Controller -> Model ^
\/
View

El Forum

[eluser]adamp1[/eluser]
Please read this section of the userguide for details on private controller functions. http://ellislab.com/codeigniter/user-gui...ml#private

El Forum

[eluser]laralaya[/eluser]
thanks for the nice information

El Forum

[eluser]katimari[/eluser]
Thanks Adam - that is exactly the info I was looking for!