Added first draft Homepage

This commit is contained in:
Kevin Frantz 2018-07-14 17:48:24 +02:00
parent d1a29b6d70
commit 2cefb4187c
14 changed files with 113 additions and 10 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace controller;
use core\CoreInterface;
/**
*
* @author kevinfrantz
*
*/
abstract class AbstractController
{
/**
* @var CoreInterface
*/
protected $core;
public function __construct(CoreInterface $core){
$this->core = $core;
}
protected function render(string $template,array $variables=[]):void{
echo $this->core->getTwig()->render($template,$variables);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace controller\standart;
use controller\AbstractController;
/**
*
* @author kevinfrantz
*
*/
final class Standart extends AbstractController
{
public function homepage():void{
$this->render('standart/homepage.html.twig');
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
<html>
<head>
<title>
{% block title %}Online Shop{% endblock %}
</title>
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1,3 @@
{% extends "base.html.twig" %}
{% block title %}Online Shop{% endblock %}
{% block body %}Welcome to the online shop ;){% endblock %}

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1 @@
<?php