MVCnPHP
| From: | Jeroen Houben | Date: | Tue, 08 Apr 2003 11:59:07 +0000 |
| Subject: | MVCnPHP | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15021@lists.php.net to get a copy of this message | ||
Hi Tony,
I'm playing around with your example, just trying out different things. I'm trying to "upgrade" the example by incorporating PEAR::DataObject, PEAR::QuickForm and (in a next phase) Smarty.
My first question is why you perform SQL SELECT queries is the Contact_View class. I understand it's just a small example so perhaps you did it just to simplify things, but shouldn't data fetching be part of a Model class?
Second question is: how would I make good use of QuickForm in this example? Quickform deals with display (View), but also with validation (Model, right?), which is a seperate class in your example. I'm not too sure where an instance of Quickform would fit as it serves both displaying purposes and validation purposes. Would it make sense to have some sort of Contact base class, which has an instance of QuickForm as a property and then have a Contact_Validate and a Contact_view class that both extend the Contact base class? Simplified it would look a little like this:
Class Contact {
var $_form;
}
Class Contact_Validate extends Contact {
function validate() {
return $this->_form->validate();} } Class Contact_View { function getView() {
return $this->_form->toHtml(); // or $this->_form->display(); } }Would that make sense? Cheers, Jeroen