feat: routing

This commit is contained in:
TheClashFruit 2023-09-15 16:47:56 +02:00
parent fe34dcd5e2
commit 1fb549af61
Signed by: TheClashFruit
GPG key ID: CF4A319B9A73290C
3 changed files with 67 additions and 4 deletions

View file

@ -1,6 +1,21 @@
<?php
require_once '_config.php';
switch ($_SERVER['REQUEST_URI']) {
case "/":
echo $twig->render('index.twig', [
'user' => null
]);
break;
case "/nations":
echo $twig->render('nations.twig', [
'user' => null
]);
break;
default:
http_response_code(404);
echo $twig->render('404.twig', [
'user' => null
]);
break;
}

24
template/404.twig Normal file
View file

@ -0,0 +1,24 @@
{% include 'includes/head.twig' with {'pageTitle': '404'} %}
<div class="pageHero" id="hero">
<div class="blurFiler">
<div class="container">
<h1>Clyde's Real Survival SMP</h1>
<div class="serverInfo">
Online: <label>0</label> / <label>20</label>
</div>
</div>
</div>
</div>
{% include 'includes/nav.twig' with {'page': '404',} %}
<main class="pageContent" id="content">
<div class="container">
<h2>This page is non-existent!</h2>
</div>
</main>
{% include 'includes/footer.twig' %}
{% include 'includes/foot.twig' %}

24
template/nations.twig Normal file
View file

@ -0,0 +1,24 @@
{% include 'includes/head.twig' with {'pageTitle': 'Nations'} %}
<div class="pageHero" id="hero">
<div class="blurFiler">
<div class="container">
<h1>Clyde's Real Survival SMP</h1>
<div class="serverInfo">
Online: <label>0</label> / <label>20</label>
</div>
</div>
</div>
</div>
{% include 'includes/nav.twig' with {'page': 'nations',} %}
<main class="pageContent" id="content">
<div class="container">
this is the home page
</div>
</main>
{% include 'includes/footer.twig' %}
{% include 'includes/foot.twig' %}