Single-page version, reads URL quesries

This commit is contained in:
ryliejamesthomas 2020-07-10 12:57:35 +10:00
parent 1d49872154
commit 8abf09a2f9
7 changed files with 14 additions and 48 deletions

View File

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en-AU">
<head>
<meta charset="UTF-8">
<title>BB Web-log Example&#65295;Demo.</title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" type="text/css" href="../basic.css" >
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="../feed-rss2.xml">
</head>
<body>
<header id="top">
<section>
<h1>BB Web-log Example&#65295;Demo.</h1>
<p><a href="../feed-rss2.xml" target="_blank">Read via <abbr title="Rich Site Summary">RSS</abbr> feed</a>.</p>
</section>
<nav>
<p>Year:</p>
<ol>
<li><a href="../">2020</a></li>
<li>2019&#9756;</li>
<li>et cetera</li>
</ol>
</nav>
</header>
<main>
<?php
foreach (array_reverse(glob("*.html")) as $filename) {
include $filename;
}
?>
</main>
<footer>
<nav>
<ul>
<li><a href="../">Web-log Home</a></li>
<li><a href="#top">Page Top</a></li>
</ul>
</nav>
</footer>
</body>
</html>

View File

@ -18,17 +18,25 @@
<nav>
<p>Year:</p>
<ol>
<li>2020&#9756;</li>
<li><a href="2019/">2019</a></li>
<li><a href="?year=2020">2020</a></li>
<li><a href="?year=2019">2019</a></li>
<li>et cetera</li>
</ol>
</nav>
</header>
<main>
<?php
foreach (array_reverse(glob("2020/*.html")) as $filename) {
include $filename;
}
if($_SERVER['QUERY_STRING']) {
// If year is requested give posts from that year--
foreach (array_reverse(glob("posts/{$_GET['year']}*.html")) as $filename) {
include $filename;
}
} else {
// --otherwise give posts from latest year.
foreach (array_reverse(glob("posts/2020*.html")) as $filename) {
include $filename;
}
}
?>
</main>
<footer>

1
tags/test-tag Normal file
View File

@ -0,0 +1 @@
2019-06-09_00:11_Example