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 <?php
if(!isset($_SESSION)) session_start();
// Default parameter values if none is defined // Default parameter values if none is defined
$defaultTemplateParameters = [ $defaultTemplateParameters = [
"title" => "Document", // Set page title "title" => "Document", // Set page title

View File

@ -1,18 +1,19 @@
<?php <?php
// This file should serve as an example showing current implemented features // 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 // 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"; $templateParameters["title"] = "Eksempel side";
// Include the top of page // 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> <p>Dette er en eksempel side</p>
<?php <?php
// Include the rest of the page // Include the rest of the page
include_once("template/_footer.php"); require_once("template/_footer.php");
?> ?>

View File

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

View File

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

View File

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

View File

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