From: Jason S. <jsw...@ya...> - 2003-01-06 18:13:24
|
Here is a version of the hello example index.php file (modifed to work with Smarty instead of XLS, but the concepts apply). You can check to see if an action was requested, if not, then use you view logic. All posts would need to go to index.php instead of phrame.php to complete these changes. index.php: <?php include('include/include.php'); session_start(); if (is_array($_REQUEST) && array_key_exists(_ACTION,$_REQUEST)) { //add controller to session if not already cached if (!$_SESSION[_CONTROLLER]) { $controller = new ActionController($options); $_SESSION[_CONTROLLER] = $controller; } //release control to controller for further processing $controller = &$_SESSION[_CONTROLLER]; $controller->process($mappings, $_REQUEST); } else { /** * Smarty Template System * * {@link http://smarty.php.net/ smarty.php.net} * {@link http://smarty.incutio.com/ smarty wiki} * {@link http://marc.theaimsgroup.com/?l=smarty-general&r=1&w=2 mail list archive} */ require_once('amp_smarty.php'); $t = new AMP_Smarty; $t->template_dir = 'views'; if ($_SESSION[_ERRORS]) { $t->assign('errors', $_SESSION[_ERRORS]->toArray()); $_SESSION[_ERRORS] = false; } if ($_SESSION['person']) { $t->assign('name', $_SESSION['person']->getName()); } $t->assign('post_script', 'index.php'); $template = ($_GET[_VIEW]) ? $_GET[_VIEW] : 'index'; $t->display($template.'.tpl'); } ?> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |