aboutsummaryrefslogtreecommitdiff
path: root/notes/index.php
blob: d883e38ca02088a19728c6ddaa940d1eb1d5d8b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!--?php 
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
?-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php 
      $stag = $_GET["tag"];
      $nostag = empty($stag);
    ?>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php if(!$nostag) { echo("#$stag | ");} ?> notes | isopod.cool v4</title>
    <link href="/style.css" rel="stylesheet" type="text/css" media="all">
  </head>
  <body>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/header.php');?>
    <main>
      <h2><?php if(!$nostag) { echo("#$stag");} else { echo("isonotes"); } ?></h2>
      <p class="h2caption">good writing + superfluous commentary</p>
      <nav class="pagenav">
        <ul>
          <li><a href="https://blog.jim-nielsen.com/2023/notes-dot-jim-nielsen-dot-com/">what?</a></li>
          <li><a href="notes.atom">atom feed</a></li>
          <?php
            $content = simplexml_load_file("notes.atom");
            $year = "-69420";
            $yc = 0;
            foreach($content->entry as $entry) {
              $nyr = substr($entry->published, 0, 4);
              if($nyr != $year) {
                $year = $nyr;
                echo "<li><a href='#$year'>$year</a></li>";
              }
            }
          ?>
        </ul>
      </nav>

      <?php
        if(!$nostag) {
          echo "<p class='backlink'><a href='.'>All notes</a></p>";
        }
        echo "<ul id='articles'>";
        $year = "-69420";
        $yc = 0;
        foreach($content->entry as $entry) {

          $pfilt = false;
          if(!$nostag) {
            foreach($entry->category as $cat) {
              $term = $cat["term"];
              if($stag == $term) {
                $pfilt = true;
              }
            }
          }

          if($pfilt or $nostag) { 
            $nyr = substr($entry->published, 0, 4);
            if($nyr != $year) {
              $year = $nyr;
              echo "<h3 id='$year'>$year</h3>";
            }
            $dt = substr($entry->published, 0, 10);
            $ti = $entry->title;
            $cats = "";
            foreach($entry->category as $cat) {
              $term = $cat["term"];
              $cats = $cats."<a class='entrytag' href='?tag=".$term."'>".$term."</a>";
            }

            $entryurl = $entry->link["href"];
            $entryprotocol = preg_replace("/:\/\/(.*)/", "://", $entryurl);
            $entrysite = preg_replace(array("/(.*):\/\//", "/\/(.*)/"), "", $entryurl);
            
            echo("<li><article class='blogentry'><p class='entrydate'><time>$dt</time> • <a href='$entryprotocol$entrysite'>$entrysite</a></p><h4 class='entrytitle'><a href='".$entry->link["href"]."'>$ti</h4></a><div class='entrysummary'>$entry->summary</div><p>$cats</p></article></li>");
          }
        }
        echo "</ul>";
      ?>
    </main>

    <?php include($_SERVER['DOCUMENT_ROOT'] . '/footer.php');?>
  </body>
</html>