diff --git a/controllers/RouterController.php b/controllers/RouterController.php index 9672b4355ff954af23274eb02593702b87878902..a65a7057180e530542c0c0d5a40fba61248f45c4 100644 --- a/controllers/RouterController.php +++ b/controllers/RouterController.php @@ -7,7 +7,21 @@ class RouterController extends Controller public function process($params) { $parsedUrl = $this->parseUrl($params[0]); - $classController = $this->toCamelCase(array_shift($parsedUrl)) . 'Controller'; + + if (empty($naparsovanaURL[0])) + $this->presmeruj('article/uvod'); + $classController = $this->toCamelCase($parsedUrl[1]) . 'Controller'; + + if (file_exists('controllers/' . $classController . '.php')) + $this->controller = new $classController; + else + $this->redirect('error'); + + $this->controller->process($parsedUrl); + + $this->data['title'] = $this->controller->header['title']; + $this->data['keywords'] = $this->controller->header['keywords']; + $this->view = 'layout'; } private function parseUrl($url) { diff --git a/index.php b/index.php index 87b7a65ceee5fdfce69bcbfbaf8bb6009864d0e8..f9c1abc847cd0489fc2505be1b9c3fcb2ac74d7d 100644 --- a/index.php +++ b/index.php @@ -13,4 +13,6 @@ function autoLoaderEngine($class) spl_autoload_register("autoLoaderEngine"); $router = new RouterKontroler(); -$router->process(array($_SERVER['REQUEST_URI'])); \ No newline at end of file +$router->process(array($_SERVER['REQUEST_URI'])); + +$router->renderView(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000000000000000000000000000000000000..6444dab1ee97e979dc0fbe5d8c7a0537d643d609 --- /dev/null +++ b/style.css @@ -0,0 +1,47 @@ +body { + font-family: verdana; + font-size: 14px; + width: 900px; + margin: 0 auto; +} + +h1 { + text-align: center; + color: #444444; + text-shadow: 3px 3px 3px #aaaaaa; +} + +footer { + font-size: 11px; + text-align: center; + padding-top: 20px; +} + +article { + text-shadow: 3px 3px 3px #aaaaaa; +} + +nav ul { + list-style-type: none; +} + +nav li { + float: left; + margin-right: 15px; +} + +nav a { + background: #6FA4F8; + color: white; + padding: 5px 10px; + border-radius: 10px; + text-decoration: none; + border: none; + cursor: pointer; +} + +nav a:hover { + background: #2976f8; + color: #EEEEEE; + text-decoration: none; +} \ No newline at end of file diff --git a/views/layout.php b/views/layout.php index e0bbab9b1ebbec6b904dc871cb552696cca3c223..faf26e8f689a2d2e5954a55008b9b135e809bbab 100644 --- a/views/layout.php +++ b/views/layout.php @@ -1,5 +1,5 @@ - + @@ -23,7 +23,7 @@
- + controller->renderView(); ?>