forked from CRSS/Website
feat: add nations page (untested)
This commit is contained in:
parent
49e9c7d1c4
commit
1f39d31187
21
index.php
21
index.php
|
@ -14,8 +14,13 @@
|
||||||
$nations = array(
|
$nations = array(
|
||||||
'rop' => array(
|
'rop' => array(
|
||||||
'name' => 'Republic of Panorama',
|
'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',
|
'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) {
|
$router->get('/u/([a-z0-9_\.]+)', function($name) {
|
||||||
global $twig, $mysql, $discord;
|
global $twig, $mysql, $discord;
|
||||||
|
|
||||||
|
|
24
template/nation.twig
Normal file
24
template/nation.twig
Normal 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' %}
|
Loading…
Reference in a new issue