|
|
@@ -59,19 +59,13 @@ function addFooter($response) |
|
|
|
$response->getBody()->write("</body></html>"); |
|
|
|
return; |
|
|
|
} |
|
|
|
function init() |
|
|
|
{ |
|
|
|
$art1 = ["slug" => "artikel-1", "title" => "Dit is titel 1", "content" => "Lorem ipsum 1"]; |
|
|
|
$art2 = ["slug" => "artikel-2", "title" => "Dit is titel 2", "content" => "Lorem ipsum 2"]; |
|
|
|
$art3 = ["slug" => "artikel-3", "title" => "Dit is titel 3", "content" => "Lorem ipsum 3"]; |
|
|
|
$art4 = ["slug" => "artikel-4", "title" => "Dit is titel 4", "content" => "Lorem ipsum 4"]; |
|
|
|
$_SESSION['blogs'] = [$art1, $art2, $art3, $art4]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$app->get('/', function (Request $request, Response $response, array $args) { |
|
|
|
if (!isset($_SESSION['blogs'])) { |
|
|
|
init(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: load the blog data |
|
|
|
|
|
|
|
$vars = [ |
|
|
|
"content" => "Dit is de main body met info" |
|
|
@@ -79,9 +73,6 @@ $app->get('/', function (Request $request, Response $response, array $args) { |
|
|
|
|
|
|
|
$twig = $this->get('twig'); |
|
|
|
addNavbar($twig); |
|
|
|
$err = ['type' => 'error', 'text' => "something's wrong"]; |
|
|
|
|
|
|
|
$twig->addMessage($err); |
|
|
|
$a = $twig->render('index.html.twig', $vars); |
|
|
|
$response->getBody()->write($a); |
|
|
|
return $response; |