require_once("{$_SERVER['DOCUMENT_ROOT']}/parts/head.php");
$pgtitle = "My Thoughts";
$pgdescription = "This page serves as my space to write down my opinion, what I feel, and some random things that worth writing down.";
- head($pgtitle, $pgdescription);
+ $pgcss = ["journal.css"];
+ head($pgtitle, $pgdescription, $pgcss);
?>
<body>
<table id="content">
<?php include_once("$parts/sidebar.php");?>
<td id="body">
- <?php include_once("$parts/underconstruction.php");?>
+ <h1>My Journal</h1>
+ <p>Feel free to read them. Please don't mind the grammatical mistakes, I am not a native English speaker but I'll do my best to improve my vocabulary and writing so I could express more my thoughts.</p>
+
+ <h2>List of entries:</h2>
+ <ul>
+ <?php
+ $journalPath = $_SERVER['DOCUMENT_ROOT'] . '/journal/';
+ $journalFiles = glob($journalPath . '*.php');
+
+ $entries = [];
+
+ foreach ($journalFiles as $fullPath) {
+ $filename = basename($fullPath);
+
+ if (!preg_match('/^\d{8}\.php$/', $filename)) {
+ continue;
+ }
+
+ $date = substr($filename, 0, 8);
+ $entries[$date] = $filename;
+ }
+
+ krsort($entries);
+
+ foreach ($entries as $date => $filename) {
+ $url = "/journal/$filename";
+ $entryName = date("F j, Y", strtotime($date));
+ echo "<li><a href=\"$url\" class=\"entry-list-item\">$entryName</a></li>\n";
+ }
+ ?>
+ </ul>
</td>
</tr>