diff --git a/engine/app/assets/css/styles.css b/engine/app/assets/css/styles.css index 6b92cfb..863bbd6 100644 --- a/engine/app/assets/css/styles.css +++ b/engine/app/assets/css/styles.css @@ -606,6 +606,10 @@ video { display: none; } +.h-screen { + height: 100vh; +} + .min-h-screen { min-height: 100vh; } @@ -634,6 +638,10 @@ video { flex-direction: column; } +.items-center { + align-items: center; +} + .justify-center { justify-content: center; } @@ -729,6 +737,11 @@ video { line-height: 2.25rem; } +.text-6xl { + font-size: 3.75rem; + line-height: 1; +} + .text-sm { font-size: 0.875rem; line-height: 1.25rem; @@ -764,6 +777,11 @@ video { letter-spacing: 0.025em; } +.text-blue-500 { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity, 1)); +} + .text-gray-500 { --tw-text-opacity: 1; color: rgb(107 114 128 / var(--tw-text-opacity, 1)); @@ -799,6 +817,11 @@ video { color: rgb(126 34 206 / var(--tw-text-opacity, 1)); } +.text-red-500 { + --tw-text-opacity: 1; + color: rgb(239 68 68 / var(--tw-text-opacity, 1)); +} + .text-white { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity, 1)); diff --git a/engine/app/controller/MainController.php b/engine/app/controller/MainController.php new file mode 100644 index 0000000..88595e2 --- /dev/null +++ b/engine/app/controller/MainController.php @@ -0,0 +1,15 @@ + + + + + + + + + Page Not Found + + + +
+

404

+

Oops! Page Not Found

+ + Go to Homepage + +
+ + + + \ No newline at end of file diff --git a/engine/app/view/View.php b/engine/app/view/View.php index e574e2d..96d3de4 100644 --- a/engine/app/view/View.php +++ b/engine/app/view/View.php @@ -1,26 +1,20 @@ routes массив, - // который хранится в файле routes.php, при помощи - include $this->routes = include($routesPath); } - // метод будет принимать управление от фронтконтроллера public function run() { - echo ("Запуск контроллера!"); - // var_dump($this->routes); - // обратимся к методу getURI() $uri = $this->getURI(); - echo $uri; - + $controllerName = ""; foreach ($this->routes as $uriPattern => $path) { - // echo "
$uriPattern -> $path"; if (preg_match("~$uriPattern~", $uri)) { $segments = explode('/', $path); $controllerName = array_shift($segments) . 'Controller'; - // делает первую букву строки заглавной $controllerName = ucfirst($controllerName); - var_dump($controllerName); - // выводим имя контроллера $actionName = 'action' . ucfirst(array_shift($segments)); - $controllerFile = __DIR__ . '/../app/controller/' . $controllerName . '.php'; - var_dump($controllerFile); - if (file_exists($controllerFile)) { - include_once($controllerFile); - } - $controllerObject = new $controllerName; + $controllerObject = new $controllerName(); $result = $controllerObject->$actionName(); - // выводим название экшена - echo '
' . $result; + // var_dump($controllerFile); } + + if (!$controllerName) { + // Page not found + $obj = new MainController(); + $obj->actionNotFound(); + // var_dump($obj); + // $controllerName = "MainController"; + // $actionName = "actionIndex"; + // $controllerObject = new $controllerName; + // $result = $controllerObject::$actionName(); + break; + } + $controllerObject = new $controllerName; + $result = $controllerObject::$actionName(); + + // выводим название экшена + echo '
' . $result; + + } } diff --git a/engine/index.php b/engine/index.php index 1985c10..7923165 100644 --- a/engine/index.php +++ b/engine/index.php @@ -1,14 +1,15 @@ $action(); +// $cntr = new $nameClassController; +// $cntr->$action(); -class MainModel -{ - public function getData() - { - return [ - 'title' => 'Main Page', - 'h3' => 'С новым годом!' - ]; - } -} -class MainController -{ - public function index() - { - $model = new MainModel(); - $view = new MainView(); - $result = $model->getData(); - $view->render($result, 'main.tpl'); - } -} -class MainView -{ - public function render($data, $tmpl) - { - var_dump($data); - } -} +// class MainModel +// { +// public function getData() +// { +// return [ +// 'title' => 'Main Page', +// 'h3' => 'С новым годом!' +// ]; +// } +// } +// class MainController +// { +// public function index() +// { +// $model = new MainModel(); +// $view = new MainView(); +// $result = $model->getData(); +// $view->render($result, 'main.tpl'); +// } +// } +// class MainView +// { +// public function render($data, $tmpl) +// { +// var_dump($data); +// } +// } -$cont = new Route(); +// $cont = new Route(); diff --git a/engine/tailwind.config.js b/engine/tailwind.config.js index 9f14409..098ad10 100644 --- a/engine/tailwind.config.js +++ b/engine/tailwind.config.js @@ -1,6 +1,6 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./template/*.{html,js}"], + content: ["./app/template/*.{html,js,php}"], theme: { extend: {}, },