Spaces:
Sleeping
Sleeping
Commit
·
a84929c
1
Parent(s):
071983c
test defaults
Browse files- mvc/app/init.php +5 -1
- mvc/app/libs/Core.php +24 -1
- mvc/public/index.php +5 -1
mvc/app/init.php
CHANGED
@@ -1 +1,5 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Loading main libraries
|
3 |
+
require_once('libs/Core.php');
|
4 |
+
require_once('libs/Controller.php');
|
5 |
+
require_once('libs/Database.php');
|
mvc/app/libs/Core.php
CHANGED
@@ -1 +1,24 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Map URL from browser as the following syntax
|
4 |
+
|
5 |
+
fqdn[/path]/controller/view/[params/]
|
6 |
+
|
7 |
+
example:
|
8 |
+
example.com/items/update/4
|
9 |
+
example.com/store/items/update/4
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Core{
|
13 |
+
protected $defaultController = 'welcome';
|
14 |
+
protected $defaultMethod = 'index';
|
15 |
+
protected $defaultParams = [];
|
16 |
+
|
17 |
+
public function __construct(){
|
18 |
+
$url = $this->getURL();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getURL(){
|
22 |
+
echo $_GET['url'];
|
23 |
+
}
|
24 |
+
}
|
mvc/public/index.php
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
<?php
|
2 |
// Load defaults
|
3 |
-
require_once('../app/init.php');
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
// Load defaults
|
3 |
+
require_once('../app/init.php');
|
4 |
+
|
5 |
+
// Instantiating controller class
|
6 |
+
|
7 |
+
$mvcApp = new Core;
|