From 1f39d31187d3d929874c44c5cd29a564c34e236d Mon Sep 17 00:00:00 2001 From: TheClashFruit Date: Tue, 28 Nov 2023 09:35:31 +0100 Subject: [PATCH] feat: add nations page (untested) --- index.php | 21 ++++++++++++++++++++- template/nation.twig | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 template/nation.twig diff --git a/index.php b/index.php index f98fead..b1b1c7d 100644 --- a/index.php +++ b/index.php @@ -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; diff --git a/template/nation.twig b/template/nation.twig new file mode 100644 index 0000000..c8f9c4e --- /dev/null +++ b/template/nation.twig @@ -0,0 +1,24 @@ +{% include 'includes/head.twig' with {'pageTitle': nation.name} %} + +{% include 'includes/hero.twig' %} + +{% include 'includes/nav.twig' with {'page': 'nation'} %} + +
+
+
    +
  • + code: {{ nation.short }} +
  • +
  • + full_name: {{ nation.name }} +
  • +
  • + flag: {{ nation.name }}'s flag. +
  • +
+
+
+ +{% include 'includes/footer.twig' %} +{% include 'includes/foot.twig' %} \ No newline at end of file