summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
author53hornet <atc@53hor.net>2021-12-10 23:17:42 -0500
committer53hornet <atc@53hor.net>2021-12-10 23:17:42 -0500
commitde9bbfdb8f0d3b366e76a5cc775690f7315c740f (patch)
treece5dd65c507ce5db6382665d824ef163e47e8d0f /includes
parente68127a6ff2428657b8dab0b90cd16bf1dd99dad (diff)
download53hor-de9bbfdb8f0d3b366e76a5cc775690f7315c740f.tar.xz
53hor-de9bbfdb8f0d3b366e76a5cc775690f7315c740f.zip
feat: custom routing, no required php in posts
Diffstat (limited to 'includes')
-rw-r--r--includes/foot.php9
-rw-r--r--includes/head.php9
-rw-r--r--includes/render_index.php24
3 files changed, 34 insertions, 8 deletions
diff --git a/includes/foot.php b/includes/foot.php
new file mode 100644
index 0000000..c128cc1
--- /dev/null
+++ b/includes/foot.php
@@ -0,0 +1,9 @@
+</article>
+<hr />
+
+<footer>
+
+</footer>
+</body>
+
+</html>
diff --git a/includes/head.php b/includes/head.php
index ba16fb0..4b95e2f 100644
--- a/includes/head.php
+++ b/includes/head.php
@@ -200,13 +200,6 @@
<body>
<?php
- if (!isset($nav) || $nav) {
- include('nav.php');
- }
+ include('nav.php');
?>
<article>
- <?php
- if (isset($title)) {
- printf('<h1>%s</h1>', $title);
- }
- ?>
diff --git a/includes/render_index.php b/includes/render_index.php
new file mode 100644
index 0000000..d90627b
--- /dev/null
+++ b/includes/render_index.php
@@ -0,0 +1,24 @@
+<header>
+ <noscript>
+ JavaScript? Where we're going we don't need JavaScript.
+ </noscript>
+</header>
+
+<h1 style="text-align: center">
+ The World Wide Web pages of Adam Carpenter (53hornet)
+</h1>
+
+<ul>
+ <?php
+ $posts = scandir('./posts', SCANDIR_SORT_DESCENDING);
+ $posts = array_filter($posts, fn ($post) => !empty($post) && $post != '.' && $post != '..');
+ #$posts = array_slice($posts, 0, 1000);
+
+ foreach ($posts as &$post) {
+ $title = str_replace('h1', 'span', fgets(fopen("./posts/$post", 'r')));
+ $date = str_split($post, 10)[0];
+ $post = str_replace('.php', '', $post);
+ printf('<li> <code>%s</code> <a href="/%s">%s</a> </li>', $date, $post, $title);
+ }
+ ?>
+</ul>