Welcome Guest, Not a member yet? Register   Sign In
What's the best way to structure code when calling multiple controllers into one page view?
#5

[eluser]Pygon[/eluser]
The answer to me seems fairly simple. Your comments controller should really only be used to taking input or action from the user and make changes in the model. The model should be your data provider, returning any comments for a given piece of content. Your view should be the one requesting data from the model. Therefore, you would have something like this.

User :: Request Content (id 1) >>
Controller :: Invoke Content View (id 1) >>
View(content) :: Request Content Data from Model(content) (id 1) >>
Model(content) :: Return Content Data to View(content) (id 1) >>
View(content) :: Display Content Data (id 1) >>
View(content) :: Invoke Comments View (id 1) >>
View(comments) :: Request Comment Data from Model(comments) (thread_id 1) >>
Model(comments) :: Return Comment Data to View(comments) (thread_id 1) >>
View(comments) :: Display Comment Data (thread_id 1) >>
:: Completed ::


Messages In This Thread
What's the best way to structure code when calling multiple controllers into one page view? - by El Forum - 03-12-2008, 08:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB