diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-07 23:02:24 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-07 23:02:24 +0200 |
commit | d90aebe04f9db8233801b358c5074230ada466eb (patch) | |
tree | 1f8e5c53f1c1b473d1657496617344f894e85032 /sticky.php | |
parent | 462f75b7e0ba21a46f1498740b8840796381a6b1 (diff) | |
download | blog-d90aebe04f9db8233801b358c5074230ada466eb.tar.gz blog-d90aebe04f9db8233801b358c5074230ada466eb.tar.bz2 blog-d90aebe04f9db8233801b358c5074230ada466eb.zip |
added web files
Diffstat (limited to 'sticky.php')
-rw-r--r-- | sticky.php | 72 |
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> | <b>Sticky</b> | <a + href="search.php">Search</a> | <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> | <a + href="https://git.wittamore.com" target="_blank" title="Git">Git</a> | <a + href="rss.xml">RSS</a> | <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> </p> + <hr /> + <p>§</p> + </body> +</html> |