commit 077a6d48d12fc0a094194e8dfc7b13e8166495b5
parent 5ad6e0e9059d8ea04d50cc763ee3637a5ddbe0f4
Author: Overseer <overseer@mona.qualityreto.net>
Date: Sat, 24 Feb 2018 01:01:14 -0600
Fixed titles and navigation.
Diffstat:
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/functions.php b/functions.php
@@ -68,6 +68,17 @@ function post_list() {
}
+function set_title() {
+
+ if( isset( $_GET['page'] ) ) {
+ $thisPage = $_GET['page'];
+ $title = TITLE . " - " . format_name( $thisPage );
+ }
+
+ return $title;
+
+}
+
function build_nav() {
$nav = "<ul class=\"nav\">\n";
@@ -76,6 +87,8 @@ function build_nav() {
$nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "index.php?page=" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n";
}
$nav .= "</ul>";
+
+ return $nav;
}
?>
diff --git a/header.php b/header.php
@@ -1,11 +1,5 @@
<?php
build_nav();
-$title = "Just a Blog!";
-
-if( isset( $_GET['page'] ) ) {
- $thisPage = $_GET['page'];
- $title .= " - " . format_name( $thisPage );
-}
-
+$title = set_title();
write_html( file_get_contents( "html/header.html" ), $title, $blogDir, $nav );
?>
diff --git a/index.php b/index.php
@@ -18,6 +18,7 @@ require_once( "functions.php" );
require_once( "lib/parsedown/Parsedown.php" );
/* This should probably be an ini file */
+define( "TITLE", "Just-A-Blog" );
define( "URL", "http://robertdherb.com/" );
if( file_exists( "./blogdir.txt" ) ) {
$blogDir = file_get_contents( "blogdir.txt" );
@@ -29,6 +30,7 @@ else {
$blogDir = "";
}
+$title = TITLE; // Change the defined title to a var to let me change it later.
//$blogDir = $documentRoot . "/" .
preg_match( "([0-9A-Za-z_\-]+)", $blogDir ) . "/";
@@ -46,6 +48,7 @@ if( !file_exists( "pages/home.md" ) ) {
sort( $pages );
+// Build the header
$headerHtml = "templates/header.html";
include( "header.php" );
$parsedown = new Parsedown();