aboutsummaryrefslogtreecommitdiff
path: root/sticky.php
diff options
context:
space:
mode:
Diffstat (limited to 'sticky.php')
-rw-r--r--sticky.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/sticky.php b/sticky.php
new file mode 100644
index 0000000..abf6650
--- /dev/null
+++ b/sticky.php
@@ -0,0 +1,72 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
+ <title>Bloggings</title>
+</head>
+<body>
+ <header>
+ <h1>Bloggings</h1>
+ <p><a href="index.php">Blog</a>&nbsp;|&nbsp;<b>Sticky</b>&nbsp;|&nbsp;<a
+ href="search.php">Search</a>&nbsp;|&nbsp;<a
+ href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp">Français</a>&nbsp;|&nbsp;<a
+ href="https://git.wittamore.com" target="_blank" title="Git">Git</a>&nbsp;|&nbsp;<a
+ href="rss.xml">RSS</a>&nbsp;|&nbsp;<a
+ href="https://bsky.app/profile/wittamore.com" target="_blank">Bluesky</a></p>
+ <hr />
+ </header>
+ <h2>Sticky pages</h2>
+ <!-- list start -->
+<?php
+// iterate through years
+$items = [];
+echo "<ul>";
+// iterate through files
+$i = 0;
+$thisdir = new DirectoryIterator("./sticky");
+foreach ($thisdir as $file) {
+ if ((!$file->isDot()) && (!$file->isDir())) {
+ $i++;
+ $content = file_get_contents($file->getPathname());
+ preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
+ $filedate = date("Y-m-d");
+
+ if (isset($date[1]) && strtotime($date[1])) {
+ $filedate = date("Y-m-d", strtotime($date[1]));
+ }
+
+ preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+ $title = "?";
+
+ if (isset($titre[1])) {
+ $title = ucfirst($titre[1]);
+ }
+ $items[$i][0] = $i;
+ $items[$i][1] = $file->getPathname();
+ $items[$i][2] = $title;
+ }
+}
+$values = array_column($items, 2);
+array_multisort($values, SORT_ASC, $items);
+
+$i = 0;
+while ($i < count($items)) {
+ echo "<li>" .
+ '<a href="' .
+ $items[$i][1] .
+ '">' .
+ ucfirst($items[$i][2]) .
+ "</a></li>";
+ $i++;
+}
+echo "</ul>";
+?>
+<!-- list end -->
+ <p>&nbsp;</p>
+ <hr />
+ <p>§</p>
+ </body>
+</html>