]> git.bochard.net Git - mysite.git/commitdiff
list all entries in my journal
authorbochard <git@bochard.net>
Tue, 5 Aug 2025 14:10:57 +0000 (22:10 +0800)
committerbochard <git@bochard.net>
Tue, 5 Aug 2025 14:20:19 +0000 (22:20 +0800)
journal/index.php
stylesheets/journal.css

index 242052f5e50d77845c1dc756683fd0eb117eda75..731b074262d7478cb4f79a41a78f7407d5a07518 100644 (file)
@@ -2,7 +2,8 @@
   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>
     
index b8377567b12a14de97cb3068c9d1b2750fc5ad12..ac93dfb8b496164823141f59cd5c93439c41d77e 100644 (file)
@@ -1,3 +1,7 @@
+.entry-list-item {
+       color: darkgreen;
+       font-style: italic;
+}
 .entry-title {
        margin-bottom: 0;
 }