diff options
| author | Philip Wittamore <philip@wittamore.com> | 2026-07-12 11:08:50 +0200 |
|---|---|---|
| committer | Philip Wittamore <philip@wittamore.com> | 2026-07-12 11:08:50 +0200 |
| commit | 420ceb49b53a8fa9d8ba8443e42e50cd7bd7cea9 (patch) | |
| tree | 3009f0564d75e3f7d1ca38507e7ebb92deaded07 /static/index.php | |
update
Diffstat (limited to 'static/index.php')
| -rwxr-xr-x | static/index.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/static/index.php b/static/index.php new file mode 100755 index 0000000..19b2e8b --- /dev/null +++ b/static/index.php @@ -0,0 +1,82 @@ +<!doctype html> +<html lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" > + <meta name="viewport" content="width=device-width, initial-scale=1.0" > + <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> + <nav> + <p><a href="/index.php">Blog</a> | <b>Static</b> | <a + href="/search.php">Search</a> | <a + href="https://git.wittamore.fr" target="_blank" title="Git">Git</a> | <a + href="https://social.wittamore.fr/philip" target="_blank" title="Fediverse">Fedi</a> | <a + href="/feeds/index.php" target="_blank" title="Feeds">Feeds</a> | <a + href="/rss.xml">RSS</a></p> + </nav> + <div class="banner"> + <img src="/images/me.jpg" alt="logo"> + <p>Comments: <a href="https://social.wittamore.fr/philip">@philip</a><br> + Contact: <a href="/images/deltachatqr.jpg">Deltachat</a> + </p> + </div> + </header> + <main> + <article> + <h2>Static pages</h2> + <!-- list start --> +<?php +// iterate through years +$items = []; +echo "<ul>"; +// iterate through files +$i = 0; +$thisdir = new DirectoryIterator("./"); +foreach ($thisdir as $file) { + if ((!$file->isDot()) && (!$file->isDir()) && ($file!="index.php")) { + $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 class="articlelink">' . + '<a href="' . + $items[$i][1] . + '">' . + ucfirst($items[$i][2]) . + "</a></li>"; + $i++; +} +echo "</ul>"; +?> + </article> + </main> + <footer> + <p>ยง</p> + </footer> + </body> +</html> |
