diff --git a/engine/Route.php b/engine/Route.php
deleted file mode 100644
index 4996679..0000000
--- a/engine/Route.php
+++ /dev/null
@@ -1,8 +0,0 @@
-route = 'admin';
- }
-}
\ No newline at end of file
diff --git a/engine/css/input.css b/engine/app/assets/css/input.css
similarity index 100%
rename from engine/css/input.css
rename to engine/app/assets/css/input.css
diff --git a/engine/css/styles.css b/engine/app/assets/css/styles.css
similarity index 100%
rename from engine/css/styles.css
rename to engine/app/assets/css/styles.css
diff --git a/engine/app/controller/AboutController.php b/engine/app/controller/AboutController.php
index 0bccc25..5fea904 100644
--- a/engine/app/controller/AboutController.php
+++ b/engine/app/controller/AboutController.php
@@ -1,6 +1,18 @@
$result,
+ 'body' => 'To home',
+ 'auth' => false
+ ], 'tpl_layout.php'));
+ print("AboutController, А кто то почувствовал перерыв?");
}
-}
\ No newline at end of file
+}
diff --git a/engine/app/model/AboutModule.php b/engine/app/model/AboutModule.php
new file mode 100644
index 0000000..80b2d21
--- /dev/null
+++ b/engine/app/model/AboutModule.php
@@ -0,0 +1,24 @@
+routes массив,
+ // который хранится в файле routes.php, при помощи - include
+ $this->routes = include($routesPath);
+ }
+
+ // метод будет принимать управление от фронтконтроллера
+ public function run()
+ {
+ echo ("Запуск контроллера!");
+ // var_dump($this->routes);
+ // обратимся к методу getURI()
+ $uri = $this->getURI();
+ echo $uri;
+
+ 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;
+ $result = $controllerObject->$actionName();
+ // выводим название экшена
+ echo '
' . $result;
+ }
+ }
+ }
+
+ private function getURI()
+ {
+ if (!empty($_SERVER['REQUEST_URI'])) {
+ return trim($_SERVER['REQUEST_URI'], '/');
+ }
+ }
+}
diff --git a/engine/lib/file2.php b/engine/core/lib/file2.php
similarity index 100%
rename from engine/lib/file2.php
rename to engine/core/lib/file2.php
diff --git a/engine/ext.php b/engine/ext.php
deleted file mode 100644
index f9d71cf..0000000
--- a/engine/ext.php
+++ /dev/null
@@ -1,7 +0,0 @@
- 'admin', 'pass' => 111];
-
-extract($user);
-
-var_dump($login);
\ No newline at end of file
diff --git a/engine/file1.php b/engine/file1.php
deleted file mode 100644
index d77f765..0000000
--- a/engine/file1.php
+++ /dev/null
@@ -1,24 +0,0 @@
-run();
+
+exit;
+
+
+
+
var_dump($_SERVER['REQUEST_URI']);
$uri = trim($_SERVER['REQUEST_URI'], '/');
@@ -51,4 +67,4 @@ class MainView
}
}
-$cont = new Route('');
+$cont = new Route();
diff --git a/engine/routes.php b/engine/routes.php
new file mode 100644
index 0000000..08a0c1a
--- /dev/null
+++ b/engine/routes.php
@@ -0,0 +1,9 @@
+ 'news/index', // actionIndex в NewsController
+ 'products' => 'product/list', // actionList в ProductController
+ 'about' => 'about/index',
+);
+// - где 'news' - строка запроса
+// 'news/index' - имя контроллера и экшена для обработки этого запроса (путь обработчика)