Kod
http://serwer/module=module1/action=action1/value=1/value2=2/.../...
Możecie coś doradzić?
<?php class FrontController { public function dispatch(){ $controller = $_GET['controller']; $action = $_GET['action']; $this -> perform($contrller, $action); } public function perform($controller, $action){ $c = new $controller(); $c -> $action(); } } abstract class Controller { /* .... */ } class NewsController extends Controller { public function showOneAction(){ /* pobieramy z bazy itp itd. */ $this -> view -> render('showOne.php'); } public function showAllAction(){ /* pobieramy z bazy itp itd. */ $this -> view -> render('showAll.php'); } } ?>
<?php abstract class sfWebController extends sfController { // ... /** * Redirects the request to another URL. * * @param string An existing URL * @param int A delay in seconds before redirecting. This is only needed on * browsers that do not support HTTP headers * @param int The status code */ public function redirect($url, $delay = 0, $statusCode = 302) { $response = $this->getContext()->getResponse(); // redirect $response->clearHttpHeaders(); $response->setStatusCode($statusCode); $response->setHttpHeader('Location', $url); $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="%d;url=%s"/></head></html>', $delay, htmlentities($url, ENT_QUOTES, sfConfig::get('sf_charset')))); if (!sfConfig::get('sf_test')) { $response->sendHttpHeaders(); } $response->sendContent(); } // ... } ?>
<?php public function getContext() return $this->context; } // -------------------- public function setHttpHeaders($strHeaderName, $strHeaderValue) { $this->arrHeaders[$strHeaderName] = $strHeaderValue; } // -------------------- public function clearHttpHeaders() { } ?>