Welcome Guest, Not a member yet? Register   Sign In
Where to put the functions
#1

[eluser]Unknown[/eluser]
Hi there,

After doing a small project in CI,i'm looking forward to do a bigger one.
But i was wondering, my controllers are getting pretty big, due the extra functions wich i need when i get my data from my modells. Also alot of these functions are the same as in my other controllers ... a bit insuffienct i guess. So i was wondering what you guys are doing with these kind of functions, do you build a librarie? or maybe helpers? I want to know this, before moving into a bigger project. Thanks!
#2

[eluser]CroNiX[/eluser]
Think of a library being a controller (of sorts), that can be used by multiple controllers, such as a user library or image manipulation library. If only 1 controller would ever use some sort of functionality, it doesn't make much sense (to me) to create a library for that, unless it is something generic enough that it could be useful on another project or something (like image manipulation). In that case, just put it in that controller and skip having to load another file.
#3

[eluser]Unknown[/eluser]
That makes sense, thanks for the anwser




Theme © iAndrew 2016 - Forum software by © MyBB