-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_pilarMVC.php
61 lines (42 loc) · 1.13 KB
/
_pilarMVC.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
51
52
53
54
55
56
57
58
59
60
61
<?php
class PilarMVC
{
private $CONFIG_MASTERPAGE_HEADER = "./view/_masterpage/header.php";
private $CONFIG_MASTERPAGE_FOOTER = "./view/_masterpage/footer.php";
private $CONFIG_CONTROLLER_DEFAULT = "home";
private $controler = "";
private $action = "";
private $parameter = "";
public function getAction()
{
return $this->action;
}
public function getParameter()
{
return $this->parameter;
}
function run()
{
$this->controller = $_REQUEST["_c"];
$this->action = $_REQUEST["_a"];
$this->element = $_REQUEST["_e"];
if($this->controller == null)
{
$this->controller = $this->CONFIG_CONTROLLER_DEFAULT;
}
include $this->CONFIG_MASTERPAGE_HEADER;
include "controller/" . $this->controller . "Controller.php";
include $this->CONFIG_MASTERPAGE_FOOTER;
}
public function url($controller, $action = "", $parameter = "")
{
if($action != "" && $parameter != ""){
return "index.php?_c=" . $controller . "&_a=" . $action . "&_p=" . $parameter;
}else if($action != ""){
return "index.php?_c=" . $controller . "&_a=" . $action;
}else{
return "index.php?_c=" . $controller;
}
}
}
?>