website/src/Controller/DefaultController.php

37 lines
1.1 KiB
PHP

<?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);
return $this->render('/page.html.twig', [
'header' => $page['header'],
'content' => $page['content'],
'title' => $page['title'],
'nineties' => (isset($_COOKIE['nineties']))
], $page['status']);
}
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);
}
}