index.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="stylesheet" href="/style.css" />
  7. <title>Bloggings</title>
  8. </head>
  9. <body>
  10. <header>
  11. <center>
  12. <h1>Bloggings</h1>
  13. <img src="images/shadocks-pumping-300.gif" alt="shadocks pumping">
  14. <br><br>
  15. <a
  16. href="static.php">Static</a>&nbsp;|&nbsp;<a
  17. href="https://shaarli.wittamore.com" target="_blank">Links</a>&nbsp;|&nbsp;<a
  18. href="https://git.wittamore.com" target="_blank">Git</a>&nbsp;|&nbsp;<a
  19. href="search.php">Search</a>&nbsp;|&nbsp;<a
  20. href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp"
  21. >FR</a
  22. >
  23. </center>
  24. <hr />
  25. </header>
  26. <p>
  27. This <a href="/articles/2023/minimalist-blog.html">minimalist blog</a> uses simple html. No Javascript, grids, or
  28. fancy formats. It can be read in a terminal text browser like
  29. <a href="https://lynx.browser.org/">Lynx</a>, a simple
  30. graphical browser like <a href="https://dillo.org/">Dillo</a>, or a state
  31. of the art browser like <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>.
  32. <a href="/images/browsers/index.php">(see examples)</a>
  33. </p>
  34. <!-- list start -->
  35. <?php
  36. // build reverse article subdirs (years)
  37. $yeardirs = [];
  38. $revyeardirs = [];
  39. $articlesubdir = new DirectoryIterator("./articles/");
  40. foreach ($articlesubdir as $dirinfo) {
  41. if ($dirinfo->isDir() && !$dirinfo->isDot()) {
  42. $yeardirs[] = $dirinfo->getFilename();
  43. }
  44. }
  45. rsort($yeardirs);
  46. // iterate through years
  47. if (is_array($yeardirs)) {
  48. foreach ($yeardirs as $key => $dirname) {
  49. echo "<h2>" . $dirname . "</h2>";
  50. echo "<ul>";
  51. $items = [];
  52. $thisdir = new DirectoryIterator("./articles/" . $dirname);
  53. // iterate through files
  54. foreach ($thisdir as $file) {
  55. if ($file != "." && $file != "..") {
  56. $content = file_get_contents($file->getPathname());
  57. preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
  58. $filedate = date("Y-m-d");
  59. if (isset($date[1]) && strtotime($date[1])) {
  60. $filedate = date("Y-m-d", strtotime($date[1]));
  61. }
  62. preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
  63. $title = "?";
  64. if (isset($titre[1])) {
  65. $title = $titre[1];
  66. }
  67. $items[] =
  68. "<li><b>" .
  69. $filedate .
  70. ' </b><a href="' .
  71. $file->getPathname() .
  72. '">' .
  73. $title .
  74. "</a></li>";
  75. }
  76. }
  77. rsort($items);
  78. foreach ($items as $key => $val) {
  79. echo $val;
  80. }
  81. echo "</ul>";
  82. }
  83. } else {
  84. echo "Not an array";
  85. }
  86. ?>
  87. <!-- list end -->
  88. <p>&nbsp;</p>
  89. <hr />
  90. <center>
  91. <h5>
  92. A minimalist blog by
  93. <a
  94. href="mailto:%70%68%69%6C%69%70%40%77%69%74%74%61%6D%6F%72%65%2E%63%6F%6D"
  95. >Philip Wittamore</a
  96. >
  97. </h5>
  98. </center>
  99. </body>
  100. </html>