1
0
Fork 0
forked from CRSS/Website

feat: add nations page (untested)

This commit is contained in:
TheClashFruit 2023-11-28 09:35:31 +01:00
parent 49e9c7d1c4
commit 1f39d31187
Signed by: TheClashFruit
GPG key ID: D61666AC77D1C29F
2 changed files with 44 additions and 1 deletions

View file

@ -14,8 +14,13 @@
$nations = array(
'rop' => array(
'name' => 'Republic of Panorama',
'flag' => 'https://git.theclashfruit.me/CRSS/CRSS/raw/branch/main/Nations/Republic%20of%20Panorama/Flag.svg',
'flag' => 'https://raw.theclashfruit.me/CRSS/CRSS/main/Nations/Republic%20of%20Panorama/Flag.svg',
'short' => 'rop',
),
'drr' => array(
'name' => 'Democratic Republic of Rayland',
'flag' => 'https://raw.theclashfruit.me/CRSS/CRSS/main/Nations/Democratic%20Republic%20of%20Rayland/bannre.png',
'short' => 'drr'
)
);
@ -76,6 +81,20 @@
}
});
$router->get('/nation/([a-z]+)', function ($nation) {
global $twig, $mysql, $nations;
$twig->addGlobal('pageUri', '/nation/' . $nation);
if(!$nations[$nation]) {
http_response_code(404);
echo $twig->render('404.twig');
} else {
}
});
$router->get('/u/([a-z0-9_\.]+)', function($name) {
global $twig, $mysql, $discord;

24
template/nation.twig Normal file
View file

@ -0,0 +1,24 @@
{% include 'includes/head.twig' with {'pageTitle': nation.name} %}
{% include 'includes/hero.twig' %}
{% include 'includes/nav.twig' with {'page': 'nation'} %}
<main class="pageContent" id="content">
<div class="container">
<ul>
<li>
code: {{ nation.short }}
</li>
<li>
full_name: {{ nation.name }}
</li>
<li>
flag: <img height="32px" src="{{ nation.flag }}" alt="{{ nation.name }}'s flag." />
</li>
</ul>
</div>
</main>
{% include 'includes/footer.twig' %}
{% include 'includes/foot.twig' %}