summaryrefslogtreecommitdiff
path: root/index.php
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 /index.php
parente68127a6ff2428657b8dab0b90cd16bf1dd99dad (diff)
download53hor-de9bbfdb8f0d3b366e76a5cc775690f7315c740f.tar.xz
53hor-de9bbfdb8f0d3b366e76a5cc775690f7315c740f.zip
feat: custom routing, no required php in posts
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 6 insertions, 27 deletions
diff --git a/index.php b/index.php
index 9813128..2781c7a 100644
--- a/index.php
+++ b/index.php
@@ -1,31 +1,10 @@
<?php
include('./includes/head.php');
-?>
-<header>
- <noscript>
- JavaScript? Where we're going we don't need JavaScript.
- </noscript>
-</header>
+if (($post = strtok($_SERVER['REQUEST_URI'], '/')) && !empty($post)) {
+ include("./posts/$post.php");
+} else {
+ include('./includes/render_index.php');
+}
-<h1 style="text-align: center">
- The World Wide Web pages of Adam Carpenter (53hornet)
-</h1>
-<ul>
- <?php
- if ($posts = glob('./posts/*.php')) {
- $early = true;
-
- foreach (array_reverse($posts) as $post) {
- if (!empty($post) && $post != '.' && $post != '..') {
- $post_name = explode('/', $post)[2];
- $date = implode('-', array_slice(explode('-', $post_name), 0, 3));
- include($post);
- printf('<li> <code>%s</code> <a href="/%s">%s</a> </li>', $date, $post, $title);
- }
- }
- }
- ?>
- <li><a href="https://www.53hor.net/posts/?C=M&O=A">All posts...</a></li>
-</ul>
-</article>
+include('./includes/foot.php');