From 0b075f3ea2616cfde4d976199a69ba631174a336 Mon Sep 17 00:00:00 2001 From: Arno Richter Date: Tue, 13 Dec 2022 22:27:21 +0100 Subject: gave up and sorted files into a directory structure. made snippets for header, nav and footer. made it easier to add additional css files as themes. prepare a little for addition of a real template engine. added a css reset file to share between themes, if warranted. --- index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index c0259c2..f435366 100644 --- a/index.php +++ b/index.php @@ -2,16 +2,18 @@ require_once(__DIR__.DIRECTORY_SEPARATOR.'config.php'); // check user credentials - $config['logged_in'] = false; $config['logged_in'] = check_login(); // subpages + $template = 'timeline'; if(is_numeric(path(0))) { // show a single blog post - require_once(ROOT.DS.'single.inc.php'); + $template = 'single'; + require_once(ROOT.DS.'templates'.DS.'single.inc.php'); } elseif(mb_strtolower(path(0)) === 'login') { - require_once(ROOT.DS.'loginform.inc.php'); + $template = 'login'; + require_once(ROOT.DS.'templates'.DS.'loginform.inc.php'); } elseif(mb_strtolower(path(0)) === 'logout') { $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; @@ -22,7 +24,8 @@ die(); } elseif(mb_strtolower(path(0)) === 'new') { - require_once(ROOT.DS.'postform.inc.php'); + $template = 'postform'; + require_once(ROOT.DS.'templates'.DS.'postform.inc.php'); } else { // redirect everything else to the homepage @@ -32,5 +35,5 @@ } // show the homepage - require_once(ROOT.DS.'timeline.inc.php'); + require_once(ROOT.DS.'templates'.DS.'timeline.inc.php'); } -- cgit v1.2.3