/
index2.php
63 lines (58 loc) · 1.13 KB
/
index2.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
62
63
<?php
define("baseurl", "http://localhost/newspaper/");
$controller = "home";
$view = "Index";
$param1 = null;
$model = null;
$message = "";
if(isset($_GET['url']))
{
$a = explode("/", $_GET['url']);
if(isset($a[0]) and $a[0] != "")
{
if(file_exists("Controller/".strip_tags($a[0])."Controller.php"))
{
$controller = $a[0];
if(file_exists("View/".$controller."/".strip_tags($a[1]).".php"))
{
$view = $a[1];
if(isset($a[2]) and $a[2] != "")
{
$param1 = $a[2];
}
}
else
{
$message = "Invalid Page Request ".htmlentities($a[1]);
}
}
else
{
$message = "Invalid Request ".htmlentities($a[0]);
}
}
}
$controllerPath = $controller."Controller";
include_once('Controller/'.$controllerPath.'.php');
$obj = new $controllerPath;
?>
<link rel="stylesheet" type="text/css" href="http://localhost/MVC_04/Styles/style.css">
<div> Header Here</div>
<div>
<?php
partialView("adminmenu");
?>
</div>
<div class="mainbody" >
<h2><?php print $obj->PageTitle; ?></h2><hr><br>
<?php
$obj->$view();
?>
</div>
<div>footer</div>
<?php
function partialView($v)
{
include_once('View/Shared/'.$v.'.php');
}
?>