ctdo.de/index.php

45 lines
1.1 KiB
PHP

<?php
require __DIR__ . '/vendor/autoload.php';
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
$pageloader = new FilesystemLoader(__DIR__ . '/pages');
$templateloader = new FilesystemLoader(__DIR__ . '/templates');
$twig_pages = new Environment($pageloader);
$twig_templates = new Environment($templateloader);
$title = '';
$content = '';
$csspath = '';
$topictreff = $twig_templates->render('topictreff.html.twig');
$nextevents = $twig_templates->render('nextevents.html.twig');
$raumstatus = 'unbekannt';
if(isset($_GET['page'])) {
$page = $_GET['page'];
switch ($page) {
case 'index':
$title = 'index';
$content = $twig_pages->render('index.html.twig', ['raumstatus' => 'unbekannt']);
break;
default:
$content = $twig_pages->render('404.html.twig', ['page' => $_GET['page']]);
break;
}
} else {
$title = 'index';
$content = $twig_pages->render('index.html.twig', ['raumstatus' => 'unbekannt']);
}
$twig_templates->render('top.html.twig', ['title' => $title, 'csspath' => $csspath]);
echo $content;
$twig_templates->render('bottom.html.twig');
?>