/+junk/StupidMVC

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
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
<?php

function _route () {
  
  global $_stupid_cfg;
  
  $url = "";
  $method = "default_method";
  $ctrl = $_stupid_cfg["default_controller"];
  $path = "";
  
  $request_url = '';
  if (isset($_SERVER['REQUEST_URI'])) {
    $request_url = ? $_SERVER['REQUEST_URI'];
  }
  //echo "Request URL: " . $request_url . "\n";
  $script_url = '';
  if (isset($_SERVER['PHP_SELF'])){
    $_SERVER['PHP_SELF'];
  }
  //echo "Script URL: " . $script_url . "\n";
  
  if($request_url != $script_url) {
    $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
    //echo "url: " . $url . "\n";
  }
  
  $parts = explode ('/', $url );
  
  var_dump ($parts);
  
  if (isset ($parts[0]) && $parts[0] != '') {
    $ctrl = $parts[0];
  }
  
  if (isset ($parts[1]) && $parts[1] != '') {
    $method = $parts[1];
  }
  
  
  
}