Ok, so here's where I'm at. I've been studying MVC/OOP, trying to roll my own as an exercise. I think I've finally grepped the purpose of each letter in the MVC acronym - 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 load a controller within that partial that handles the view selection based on the request data.
I looked at application controllers, but the examples I've seen simply loop through a whole bunch of commands, and I figure I only want to execute a command/control per partial, so I'm not sure if this is the right way to go.
So, my question is:
- what would you recommend?
- How would you define the component I've described, is it a controller, a command pattern, or a filthy Page Controller?
Caveat: The "application" is nothing more than a basic brochure site, but I wanted to tackle something simple to grasp the concept.