DK2/templates/layouts/basic.php

80 lines
1.8 KiB
PHP
Raw Normal View History

2024-09-27 18:45:33 -05:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dragon Knight</title>
2024-10-03 12:02:32 -05:00
<link rel="stylesheet" href="/assets/css/dragon.css">
2024-09-27 18:45:33 -05:00
</head>
<body>
2024-10-03 12:02:32 -05:00
<header>
<div class="left">
2024-09-27 18:45:33 -05:00
<h1>Dragon Knight</h1>
2024-10-03 12:02:32 -05:00
</div>
2024-09-27 18:45:33 -05:00
2024-10-03 12:02:32 -05:00
<div class="right">
<?php if (user()): ?>
<p>Welcome, <?= user('username') ?></p>
<?= c_logout_button() ?>
<?php else: ?>
<a class="ui button primary" href="/auth/login">Login</a>
<a class="ui button secondary" href="/auth/register">Register</a>
2024-10-03 16:25:25 -05:00
<?php endif; ?>
2024-10-03 12:02:32 -05:00
</div>
</header>
2024-09-27 18:45:33 -05:00
2024-10-03 12:36:49 -05:00
<?= c_char_bar(user('char_id')) ?>
2024-10-03 12:02:32 -05:00
<main>
2024-10-03 16:25:25 -05:00
<aside id="left">
<?php if (user()) echo c_left_nav($activeTab ?? 0); ?>
2024-10-03 16:25:25 -05:00
</aside>
<div id="center">
<?= render($view, $data) ?>
</div>
<aside id="right">
<?php if (user()): ?>
// right nav
<?php endif; ?>
</aside>
2024-10-03 12:02:32 -05:00
</main>
<footer>
<p>&copy; <?= date('Y') ?> Dragon Knight</p>
<p>q<?= $GLOBALS['queries'] ?></p>
<p>qt<?= number_format($GLOBALS['query_time'], 3) ?></p>
<p>t<?= number_format((microtime(true) - START_TIME), 3) ?></p>
2024-10-03 12:02:32 -05:00
<p>v<?= env('version') ?></p>
</footer>
2024-10-03 16:25:25 -05:00
<?php
if (env('debug', false)) {
echo c_debug_query_log();
}
?>
2024-10-03 16:25:25 -05:00
<script type="module">
import Tooltip from '/assets/scripts/tooltip.js';
Tooltip.init();
</script>
<script>
// Get all elements with data-alert-close attribute; when clicked, delete parent element
document.querySelectorAll('[alert-close]').forEach(function (el) {
el.addEventListener('click', function () {
el.parentNode.remove();
});
});
// Get all elements with a data-auto-close attribute; after x seconds, delete the element
document.querySelectorAll('[auto-close]').forEach(function (el) {
setTimeout(function () {
el.remove();
}, el.getAttribute('auto-close'));
});
</script>
2024-09-27 18:45:33 -05:00
</body>
</html>