just-a-blog

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 1465e41253a99027ea823abb91401a77a2eec52e
parent 01c033ca2e21ca29759c466c86a98c291f2747d6
Author: Overseer <overseer@mona.qualityreto.net>
Date:   Sat, 24 Feb 2018 01:23:37 -0600

Moved config details out of index.php

Diffstat:
config.php | 15+++++++++++++++
index.php | 22+++++-----------------
2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/config.php b/config.php @@ -0,0 +1,15 @@ +<?php + +// Edit this line to change what appears in the title bar of your blog. +define( "TITLE", "Just-A-Blog" ); + +/* Edit this line with the base URL to your site (include a trailing slash + * sub-directories. EG: if your blog is at https://www.example.com/blog + * then you would enter https://example.com/ + */ +define( "URL", "https://localhost/" ); + +// Edit this line to tell JAB where your blog lives on your server. +define( "BLOGDIR", "just-a-blog" ); + +?> diff --git a/index.php b/index.php @@ -16,26 +16,14 @@ $documentRoot = $_SERVER["DOCUMENT_ROOT"]; require_once( "functions.php" ); require_once( "lib/parsedown/Parsedown.php" ); +require_once( "config.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" ); -} - -else { - trigger_error( "Could not find blogdir.txt, make sure it is in the same - directory as index.php. Assuming blog is at \"/\"", E_USER_NOTICE ); - - $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 ) . "/"; +//BLOGDIR = $documentRoot . "/" . + preg_match( "([0-9A-Za-z_\-]+)", BLOGDIR ) . "/"; - define( "BLOG_DIR", $blogDir ); + define( "BLOG_DIR", BLOGDIR ); $pages = scandir( "pages/" ); $pages = array_diff( $pages, array( "..", "." ) ); @@ -50,7 +38,7 @@ sort( $pages ); // Build the header $headerHtml = "templates/header.html"; -write_html( file_get_contents( "html/header.html" ), set_title(), $blogDir, build_nav( $pages ) ); +write_html( file_get_contents( "html/header.html" ), set_title(), BLOGDIR, build_nav( $pages ) ); $parsedown = new Parsedown(); if( isset( $_GET['page'] ) ) {