Files
sistav.com/log/index.php
T
2026-06-01 18:08:37 -04:00

47 lines
1.6 KiB
PHP

<?php
$title = 'Log';
$description = "Running tab of my time.";
include $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php';
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/assets/data/log.json'), true);
$entries = $data['entries'] ?? [];
$fields = ['listening', 'watching','playing', 'reading', 'working on', 'thinking'];
?>
<body>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/includes/nav.php'; ?>
<main class="page">
<div class="wrap">
<h1>Log</h1>
<p class="incantation">What I've been spending my time on. It's most likely not upto date.</p>
<div class="entry-list">
<?php if (empty($entries)): ?>
<p class="empty">Nothing yet.</p>
<?php endif; ?>
<?php foreach ($entries as $entry): ?>
<article class="cat-box">
<div class="log-head">
<h2><?= htmlspecialchars($entry['title']) ?></h2>
<span class="log-date"><?= date('F j, Y', strtotime($entry['date'])) ?></span>
</div>
<dl class="log-fields">
<?php foreach ($fields as $field): ?>
<?php if (!empty($entry[$field])): ?>
<div class="log-row">
<dt class="log-key"><?= $field ?></dt>
<dd class="log-val"><?= htmlspecialchars($entry[$field]) ?></dd>
</div>
<?php endif; ?>
<?php endforeach; ?>
</dl>
</article>
<?php endforeach; ?>
</div>
</div>
</main>
</body>
</html>