website/src/Controller/DefaultController.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2021-08-05 13:51:44 +02:00
<?php
namespace JeroenED\Website\Controller;
use JeroenED\Framework\Controller;
use JeroenED\Framework\Repository;
use JeroenED\Website\Repository\Page;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
public function DefaultAction($page)
{
$pageRepo = new Page();
$page = $pageRepo->getPage($page);
2021-08-05 14:46:20 +02:00
return $this->render('/page.html.twig', [
'header' => $page['header'],
'content' => $page['content'],
2021-08-06 09:51:41 +02:00
'title' => $page['title'],
'nineties' => (isset($_COOKIE['nineties']))
], $page['status']);
2021-08-05 13:51:44 +02:00
}
2021-08-06 12:30:00 +02:00
public function ErrorAction($status)
{
$pageRepo = new Page();
$page = $pageRepo->getPage('error/' . $status);
return $this->render('/page.html.twig', [
'header' => $page['header'],
'content' => $page['content'],
'title' => $page['title'],
'nineties' => (isset($_COOKIE['nineties']))
], $status);
}
2021-08-05 13:51:44 +02:00
}