/
page_producer.php
50 lines (29 loc) · 1.28 KB
/
page_producer.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
class pageProducer extends core{
function __construct($pageDetails, $pageQuery, $mappedPage){
$this->add_array_item("pageName", $pageDetails['name']);
$this->add_array_item("pageID", $pageDetails['id']);
$this->add_array_item("pageAddress", $pageDetails['address']);
$this->add_array_item("pageQuery", $pageQuery);
require_once("./engine/page/" . $this->pageDataArray['pageAddress'] . "/function/page_function.php"); //core functions; other function scripts may be called later on during this class!
$this->post = new post($this->pageDataArray['pageQuery']);
$this->construct_data();
}
function add_array_item($associativeKey, $associativeData){
if(ctype_alnum($associativeKey)){
$this->pageDataArray[$associativeKey] = $associativeData;
}else{
send_error_log("page generation failed: invalid array key parsed -> [" . $associativeKey . "] = ". $associativeData);
}
}
function construct_data(){
$this->pageTemplate = "main_index.php";
$this->add_array_item("styles", "main_index.css");
$this->add_array_item("thread", $this->post->get_thread());
}
function produce_page(){
require("./engine/page/" . $this->pageDataArray['pageAddress'] . "/product/" . $this->pageTemplate);
build_page($this->pageDataArray);
}
}
?>