bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
|
1
by Gustav Hartvigsson
* initial code |
1 |
<?php
|
2 |
||
3 |
function _rout () { |
|
4 |
||
5 |
global $_stupid_cfg; |
|
6 |
||
7 |
$url = ""; |
|
8 |
$method = "default_method"; |
|
9 |
$ctrl = $_stupid_cfg["default_controller"]; |
|
10 |
||
11 |
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : ''; |
|
12 |
//echo "Request URL: " . $request_url . "\n";
|
|
13 |
$script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : ''; |
|
14 |
//echo "Script URL: " . $script_url . "\n";
|
|
15 |
||
16 |
if($request_url != $script_url) { |
|
17 |
$url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/'); |
|
18 |
//echo "url: " . $url . "\n";
|
|
19 |
}
|
|
20 |
||
21 |
$parts = explode ('/', $url ); |
|
22 |
||
23 |
if (isset ($parts[0]) && $parts[0] != '') { |
|
24 |
$ctrl = $parts[0]; |
|
25 |
}
|
|
26 |
||
27 |
if (isset ($parts[1]) && $parts[1] != '') { |
|
28 |
$method = $parts[1]; |
|
29 |
}
|
|
30 |
||
31 |
}
|
|
32 |