Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
42 lines (38 loc) · 1.52 KB
/
Copy pathindex.php
File metadata and controls
42 lines (38 loc) · 1.52 KB
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
35
36
37
38
39
40
41
42
<?php
/**
* Main file index.php
*/
/* Set some constants, the config file and the autoloader machanism. */
defined('BASEPATH') or define('BASEPATH', realpath(dirname(__FILE__)));
require_once(BASEPATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
//require_once (BASEPATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php');
$page = new Page(''); // instatiate the page
defined('BASEURL') or define('BASEURL', $page->getBaseUrl());
/* Get the action parameter and decide what to do next. */
$action = (string)filter_input(INPUT_GET, 'action');
// Setup variables
$content = "";
$title = "";
switch ($action) {
case "show":
$content .= file_get_contents(BASEPATH . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'Show.html');
break;
default:
$content .= "Hier folgt die Startseite...";
}
/* * *************************
* Show the page *
* ************************* */
// We create an assoc pageDataArray to store the locations of the templates that we feed into the template engine and the baseUrl.
$pageDataArray = [
'baseUrl' => BASEURL,
'title' => $title,
'content' => $content,
];
/*
* The content variable parses the basic structure of every page - the index.html - which includes the
* variables header, footer, title and main, which gets taken from the templates of $pageDataArray.
* To display we content, we merely have to echo it.
*/
$content = $page->parseTemplate('templates/index.html', $pageDataArray);
echo $content;