Welcome Guest, Not a member yet? Register   Sign In
Controller Organisation
#1

[eluser]Marvin_S[/eluser]
Hey Guys,

I am fairly new to this CodeIgniter thingybob. Actually I am just about to start my first real project in CodeIgniter. Anyway, I think I understood the very basics of MVC etc. but there is still one thing where I am sure that I can profit from the experience of the long-time CodeIgniter users: The organisation of my controllers.

My example:

I have to create a comparable simple Admin Backend for a customer. So far I used structured programming techniques without any framework. I had the following structure in mind:

Admin login:
-> ACP Root
--> Article-Management (Show Articles, Create Articles, Delete Articles, Edit Articles)
--> Gallery-Management (Show Galleries, Create Pictures, Delete Pictures, Edit Pictures)

So now I wondered how to organize my controllers. My first thought was creating one controller for each main feature and create a function for each function. (Makes sense, heh?)

So for instance I got following controllers with the following functions in addition to the index function:

C1: login (functions: validate_input)
C2: Root (none)
C3: Article (functions: show, add, drop, edit)
C4: Gallery (functions: show, add, drop, edit)

Now that looked great for me first but after some further thinking I noticed I still miss validation proceses for the certain add/edit functions (and most likeley even more) so I need to create more functions for each controller... This made me think again: For better organisation, would it be better to create additional controllers for show, add, drop ... etc.? I think if I would just pack all functions related to Article into one Controller I made end up in huge Controller files.

Anybody with ideas on this? Which way is better? Maybe a completely different way? I hope I could make my point clear. If there are any questions, just ask.

Thanks in advance,
Marvin

PS: If you wonder why you can't create/drop/delete galleries, it's because each article will receive his own possible gallery automatically. So creating/deleting/editing articles will influence already the galleries.


Messages In This Thread
Controller Organisation - by El Forum - 04-25-2010, 01:24 PM
Controller Organisation - by El Forum - 04-25-2010, 01:50 PM
Controller Organisation - by El Forum - 04-25-2010, 02:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB