diff --git a/example.php b/example.php
index 3a59d3d..6d199ad 100644
--- a/example.php
+++ b/example.php
@@ -1,15 +1,17 @@
-
Eksempel side
-Dette er en eksempel side
+
+ Eksempel side.
+ Dette er en eksempel side
+
@@ -12,6 +10,5 @@ include_once("template/_header.php");
\ No newline at end of file
diff --git a/login.php b/login.php
index 0eb9b52..2ea2b5e 100644
--- a/login.php
+++ b/login.php
@@ -3,7 +3,7 @@
if ((isset($_POST['username'])) && (isset($_POST['password']))) {
if (($_POST['username'] === 'VG3') && ($_POST['password'] === '3ELDEA')) {
session_start();
- $_SESSION['logged_in'] = true;
+ $_SESSION['logged_in'] = TRUE;
$_SESSION['username'] = $_POST['username'];
header("Location: index.php");
exit;
@@ -13,10 +13,8 @@ if ((isset($_POST['username'])) && (isset($_POST['password']))) {
}
}
-// Parameters that will be used in the template file
-$templateParameters["title"] = "Logg inn"; // Sets the page title
+$templateParameters["title"] = "Logg inn";
-// Include the top of page
include_once("template/_header.php");
?>
Logg inn
@@ -27,7 +25,6 @@ include_once("template/_header.php");
?>
\ No newline at end of file
diff --git a/template/_footer.php b/template/_footer.php
index 6962b21..17ffe3b 100644
--- a/template/_footer.php
+++ b/template/_footer.php
@@ -1,5 +1,8 @@
diff --git a/template/_header.php b/template/_header.php
index f629c0a..c620ce7 100644
--- a/template/_header.php
+++ b/template/_header.php
@@ -1,5 +1,6 @@
1)) {
$templateUrlPrefix = htmlspecialchars($templateUrlPrefix . DIRECTORY_SEPARATOR);
}
-if ($templateParameters["render"] === false) {
+if ($templateParameters["render"] === FALSE) {
return;
}
?>
@@ -26,7 +27,6 @@ if ($templateParameters["render"] === false) {
-
+
+
Logg ut
Inlogget som: =htmlspecialchars($_SESSION['username'])?>
+
diff --git a/template/templateParameters.php b/template/templateParameters.php
new file mode 100644
index 0000000..676f826
--- /dev/null
+++ b/template/templateParameters.php
@@ -0,0 +1,11 @@
+ "Document", // Set page title
+ "render" => TRUE, // Whether or not to render the template
+];
+
+// Initialize default parameter values
+foreach(array_keys($defaultTemplateParameters) as $key) {
+ if (!isset($templateParameters[$key])) $templateParameters[$key] = $defaultTemplateParameters[$key];
+}