aboutsummaryrefslogtreecommitdiff
path: root/notes/index.php
blob: 9daaf254808774ece95c4aab37fa6811165dd7b2 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--?php 
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
?-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Notes</title>
    <link href="../style.css" rel="stylesheet" type="text/css" media="all">
    <style>
      .noteentry {
        max-width: 100%;
        list-style: none;
        display: inline-block;
        margin: var(--stdpadding) 0;
      }
      .noteentry h3 {
        margin-top: 0;
      }
      /*ul h2:first-of-type::before {
        content: "Articles - "
      }*/
      .noteentry > * {
        display: block;
        box-sizing: border-box;
      }
      .entrytag {
        font-size: .9em;
        color: #bbbbbb;
        font-style: italic;
        display: inline-block;
        margin-right: 1ch;
      }
      .entrydate {
        font-weight: bold;
      }
      .entrytitle {
        padding-left: initial;
        border-left: initial;
      }
    </style>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
  </head>
  <body>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/nav.php'); bg(true); ?>
    <h1>isonotes</h1>
    <h2 id="caption">superfluous commentary</h2>
    <nav>
      <a href="notes.atom">atom feed</a>
      <?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 "<a href='#$year'>$year</a>";
          }
        }
      ?>
    </nav>
    <?php
      $stag = $_GET["tag"];
      $nostag = empty($stag);
      if(!$nostag) {
        echo "<a style='display: block; margin-top: 1rem; margin-bottom: 1rem;' href='.'>All notes</a>";
      }
      $year = "-69420";
      $yc = 0;
      $yeag = false;
      foreach($content->entry as $entry) {
        
        if($yeag) {
          echo "<hr>";
        } else {
          $yeag = true;
        }

        $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 "<h2 id='$year'>$year</h2>";
          }
          $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>";
          }
          
          echo "<article class='noteentry'><time class='entrydate'>$dt</time><h3 class='entrytitle'><a href='".$entry->link["href"]."'>$ti</h3></a>$entry->summary<span>$cats</span></article>";
        }
      }
    ?>
    
  </body>
</html>