|
|
@@ -28,16 +28,24 @@ function addFooter($response) |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
$app->get('/', function (Request $request, Response $response, array $args) { |
|
|
|
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]; |
|
|
|
} |
|
|
|
|
|
|
|
addNavbar($response); |
|
|
|
|
|
|
|
$app->get('/', function (Request $request, Response $response, array $args) { |
|
|
|
init(); |
|
|
|
addNavbar($response); |
|
|
|
$response->getBody()->write('<hr/><h1>Onze blog</h1>'); |
|
|
|
$response->getBody()->write('<ul>'); |
|
|
|
$response->getBody()->write('<li><a href="/blog/artikel-1">Blogartikel 1</a></li>'); |
|
|
|
$response->getBody()->write('<li><a href="/blog/artikel-2">Blogartikel 2</a></li>'); |
|
|
|
$response->getBody()->write('<li><a href="/blog/artikel-3">Blogartikel 3</a></li>'); |
|
|
|
$response->getBody()->write('<li><a href="/blog/artikel-4">Blogartikel 4</a></li>'); |
|
|
|
foreach ($_SESSION['blogs'] as $art) { |
|
|
|
$response->getBody()->write('<li><a href="/blog/' . $art['slug'] . '">' . $art['title'] . '</a></li>'); |
|
|
|
} |
|
|
|
$response->getBody()->write('</ul>'); |
|
|
|
$response->getBody()->write('<hr/>'); |
|
|
|
addFooter($response); |