-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvaegar.php
34 lines (29 loc) · 1.03 KB
/
vaegar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require __DIR__ . "/incl/multipage.php";
// Get what subpage to show, defaults to index
$pageReference = $_GET["page"] ?? "index";
$pageReference = $pageReference == '' ? 'index' : $pageReference;
//var_dump($pageReference);
// Get the filename of this multipage, exkluding the file suffix of .php
$base = basename(__FILE__, ".php");
$dsn = $databases[$_SESSION['database']];
$db = connectToDatabase($dsn);
$tableName = 'Object';
$subpages = getPagesFromTable($db, 'Object');
// Create the collection of valid sub pages.
$pages = [];
foreach ($subpages as $subpage) {
$pages[] = [
'title' => $subpage['title'],
'name' => $subpage['name'],
];
}
// Get the current page from the $pages collection, if it matches
$page = $pages[$pageReference] ?? null;
// Base title for all pages and add title from selected multipage
// $title = $page["title"] ?? "404";
$title = "Vägar";
// Render the page
require __DIR__ . "/incl/header.php";
require __DIR__ . "/sidmeny/vaegar-aside.php";
require __DIR__ . "/incl/footer.php";