TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Controlling partial views in MVC (http://www.talkphp.com/advanced-php-programming/4836-controlling-partial-views-mvc.html)

sunwukung 08-10-2009 11:21 AM

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.


All times are GMT. The time now is 08:31 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0