
Originally Posted by
HarryF
Made an attempt at demonstrating the simplest possible MVC example in PHP I could imagine
here (pages 9, 10 and 11 are the complete example). May be helps explain what MVC is about.
Thanks Harry! It does help me understand better. But I had a question on the tutorial on PHP Patterns. MVC 2 the index.php would be the controller correct? You had a switch in there that deteremined which controller class to run. Is that correct? Meaning are you using the controller to determine which controller to run?
PHP Code:
$dao=& new DataAccess ('localhost','','','');
switch ( $_GET['view'] ) {
case "product":
$controller=& new ProductItemController($dao,$_GET);
break;
default:
$controller=& new ProductTableController($dao,$_GET);
break;
}
$view=$controller->getView();
echo ("<pre>" );
// print_r($controller);
echo ("</pre>" );
echo ($view->display());
Silly
Bookmarks