model view controller pattern

I’m still working away at a registration process using the MVC pattern. It’s coming along very nicely in fact! Here’s an article describing it in some depth.
I’ve hijacked the idea somewhat for my project. I have one controller, and multiple views/models. There’s one model and view for each page. The view is split between PHP code and Smarty templates. The PHP code doesn’t do much beyond assigning variables for the Smarty templates but I wouldn’t put those assign calls into the model, as then the model would have to know about Smarty. This makes it easy to figure out where something is going wrong, and where I need to _put_ code.
How many of you have “super” classes with thousands of lines of code? That sucks for maintainability.
While some of the Java examples I’ve seen redirect the browser to the new view, I simply unset the old model and view and create the new model and view. The single solitary display() call at the end of the controller takes care of displaying whatever view is active!
Must post some example PHP code later.

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close