Move some stuff around. Idk

This commit is contained in:
William 2021-10-09 22:01:18 +02:00
parent e9ece025d0
commit 52c15ae1c6
7 changed files with 17 additions and 14 deletions

2
app/common.php Normal file
View File

@ -0,0 +1,2 @@
<?php
if(!isset($_SESSION)) session_start();

View File

@ -1,6 +1,4 @@
<?php
if(!isset($_SESSION)) session_start();
// Default parameter values if none is defined
$defaultTemplateParameters = [
"title" => "Document", // Set page title
@ -19,4 +17,4 @@ if (empty($templateUrlPrefix)) {
if ((strlen($templateUrlPrefix) > 1)) {
$templateUrlPrefix = htmlspecialchars($templateUrlPrefix . DIRECTORY_SEPARATOR);
}
}
}

View File

@ -1,18 +1,19 @@
<?php
// This file should serve as an example showing current implemented features
require_once("app/common.php");
// Parameters that will be used in the template files
// For more options and explanations, check the 'templateParameters.php' file from the 'template' folder
// For more options and explanations, check the 'app/template.php' file
$templateParameters["title"] = "Eksempel side";
// Include the top of page
include_once("template/_header.php");
require_once("template/_header.php");
?>
<h1>Eksempel side.</h1>
<h1>Eksempel side</h1>
<p>Dette er en eksempel side</p>
<?php
// Include the rest of the page
include_once("template/_footer.php");
require_once("template/_footer.php");
?>

View File

@ -1,7 +1,9 @@
<?php
require_once("app/common.php");
$templateParameters["title"] = "Forside";
include_once("template/_header.php");
require_once("template/_header.php");
?>
<h1>Om stafett for livet</h1>
@ -10,5 +12,5 @@ include_once("template/_header.php");
<a href="img/stafett.jpg"><img src="img/stafett-cropped.jpg"></a>
<?php
include_once("template/_footer.php");
require_once("template/_footer.php");
?>

View File

@ -1,5 +1,5 @@
<?php
session_start();
require_once("app/common.php");
// Login logic
if ((isset($_POST['username'])) && (isset($_POST['password']))) {
@ -16,7 +16,7 @@ if ((isset($_POST['username'])) && (isset($_POST['password']))) {
$templateParameters["title"] = "Logg inn";
include_once("template/_header.php");
require_once("template/_header.php");
?>
<h1>Logg inn</h1>
<?=
@ -39,5 +39,5 @@ include_once("template/_header.php");
</form>
<?php
include_once("template/_footer.php");
require_once("template/_footer.php");
?>

View File

@ -1,5 +1,5 @@
<?php
include_once("templateParameters.php");
require_once(__DIR__ . "/../app/template.php");
if ($templateParameters["render"] === FALSE) {
return;

View File

@ -1,5 +1,5 @@
<?php
include_once("templateParameters.php");
require_once(__DIR__ . "/../app/template.php");
if ($templateParameters["render"] === FALSE) {
return;