diff --git a/src/controller/AbstractController.php b/src/controller/AbstractController.php new file mode 100644 index 0000000..a82fdfc --- /dev/null +++ b/src/controller/AbstractController.php @@ -0,0 +1,26 @@ +core = $core; + } + + protected function render(string $template,array $variables=[]):void{ + echo $this->core->getTwig()->render($template,$variables); + } +} + diff --git a/src/controller/standart/Standart.php b/src/controller/standart/Standart.php new file mode 100644 index 0000000..4b7a746 --- /dev/null +++ b/src/controller/standart/Standart.php @@ -0,0 +1,17 @@ +render('standart/homepage.html.twig'); + } +} + diff --git a/src/router/Router.php b/src/router/Router.php index 5938741..d40d013 100644 --- a/src/router/Router.php +++ b/src/router/Router.php @@ -2,6 +2,7 @@ namespace router; use core\CoreInterface; +use controller\standart\Standart; /** * @@ -10,19 +11,58 @@ use core\CoreInterface; */ final class Router implements RouterInterface { - public function route() + /** + * @var CoreInterface + */ + private $core; + + /** + * + * @var array + */ + private $get; + + /** + * + * @var array + */ + private $post; + + public function route():void { - echo "Hello World!"; + if($this->post['route']){ + $this->postRouting(); + } + if($this->get['router']){ + $this->getRouting(); + }else{ + $standart = new Standart($this->core); + $standart->homepage(); + } + } + + private function postRouting():void{ + + } + + private function getRouting():void{ + } - public function setGet(array $get) - {} + public function setGet(array $get):void + { + $this->get = $get; + } - public function setCore(CoreInterface $core) - {} + public function setCore(CoreInterface $core):void + { + $this->core = $core; + } public function setPost(array $post): void - {} + { + $this->post = $post; + } } diff --git a/src/router/RouterInterface.php b/src/router/RouterInterface.php index 0e9095f..3aff324 100644 --- a/src/router/RouterInterface.php +++ b/src/router/RouterInterface.php @@ -10,7 +10,7 @@ use core\CoreInterface; */ interface RouterInterface { - public function setCore(CoreInterface $core); + public function setCore(CoreInterface $core):void; /** * Post parameters are used to save data @@ -22,10 +22,10 @@ interface RouterInterface * Get Parameters are used to request Data * @param array $get */ - public function setGet(array $get); + public function setGet(array $get):void; /** * Opens the controller */ - public function route(); + public function route():void; } diff --git a/src/template/base.html.twig b/src/template/base.html.twig new file mode 100644 index 0000000..5e3583a --- /dev/null +++ b/src/template/base.html.twig @@ -0,0 +1,10 @@ + + + + {% block title %}Online Shop{% endblock %} + + + + {% block body %}{% endblock %} + + \ No newline at end of file diff --git a/src/template/product/basket/basket.html.php b/src/template/product/basket/basket.html.php new file mode 100644 index 0000000..e69de29 diff --git a/src/template/product/basket/list.html.php b/src/template/product/basket/list.html.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/src/template/product/basket/list.html.php @@ -0,0 +1 @@ +