Welcome Guest, Not a member yet? Register   Sign In
Best MVC design practice?
#5

[eluser]Fred Riley[/eluser]
Thanks to all for the replies, which have given me plenty to reflect on. I did RTFM, honestly, and on reflection the answers to 2, 3 and 4 were present in the pages on models, controllers and helpers, though by implication rather than directly. The trick is to internalise the CI model and 'modus operandi' which will come with practice.

[quote author="oldblueday" date="1282681747"]

3. I've been using one model per database table. For example I have tables called 'students', 'rotations', 'questions', 'quizzes', etc. So I have models named 'student', 'rotation', 'question', 'quiz', etc. [/quote]

I can see the logic in that, but where do you put your multi-table joins? If you want to find out what quizzes a student's done, in which model do you put your query?

[quote author="mddd" date="1282681747"]
2. No. The controllers are meant to give structure. They split up the application into manageable parts! And in CI, there is a large part of automation in the controller phase: depending on the called url, a certain method in a certain controller is loaded. So the question ‘where are we in the application’ is answered in this phase.[/quote]

This is where I've already been involved in bad practice, then. I'm coding a database of online resources, so my URLs (with mod_rewrite) are of the form:

http://localhost/PHP/codeigniter/resourcedb/browse/

where the application root is "http://localhost/PHP/codeigniter/" with one controller - resourcedb - containing various methods (browse, search, insert, etc). I should be thinking one step up, and having controllers for browse, search, insert, etc. What I need to get my head around is how to tie all the controllers into a coherent whole...

Cheers

Fred

PS: The search still returns null, and now I find that submitting this reply returns an empty 'reply to' form and doesn't submit. I also had the devil's own time registering for this forum, with the captcha giving me real grief. Maybe rats have been nibbling at the network cables... Anyway, I'll try with IE instead of FF, which logically shouldn't make a difference but who knows.


Messages In This Thread
Best MVC design practice? - by El Forum - 08-24-2010, 07:49 AM
Best MVC design practice? - by El Forum - 08-24-2010, 08:10 AM
Best MVC design practice? - by El Forum - 08-24-2010, 08:11 AM
Best MVC design practice? - by El Forum - 08-24-2010, 09:29 AM
Best MVC design practice? - by El Forum - 08-24-2010, 10:14 AM
Best MVC design practice? - by El Forum - 08-24-2010, 10:31 AM
Best MVC design practice? - by El Forum - 08-24-2010, 10:40 AM
Best MVC design practice? - by El Forum - 08-24-2010, 10:44 AM
Best MVC design practice? - by El Forum - 08-24-2010, 10:48 AM
Best MVC design practice? - by El Forum - 08-24-2010, 12:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB