08-10-2009, 11:21 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Jul 2009
Location: Bristol
Posts: 8
Thanks: 0
|
Controlling partial views in MVC
My question here pertains to a design decision.
I've set up an FC of sorts - it takes parameters from the $_GET array and loads the appropriate sub-template into a master template using an include. Each sub-template also performs a similar trick, and loads in a set of partials to allow for complex layout requirements. As I was doing this, I got the sneaking suspicion I hadn't quite grasped everything - the Model wasn't making a significant appearance (although to be fair the 'application' has little in the way of a data layer).
Then I figured I should tackle the contact form, which requires three states/views, submitted with no errors, submitted with errors, and not submitted. I've seen a number of approaches to this problem, and I wanted to get some feedback. What I intend to do is invoke a command within that partial that handles the request data and invokes the relevant view.
I looked at application controllers, but the examples I've seen simply loop through an array of commands, and I need to execute a command/control per partial, so I'm not sure if this is the right way to go.
So, my question is:
1. what pattern would you recommend in this situation? Application Controller, Command or Page Controller.
2. How would you define the component I've described?
Caveat: The "application" is nothing more than a basic brochure site, but I wanted to tackle something simple to grasp the concept.
|
|
|
|