/+junk/StupidMVC

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
1 by Gustav Hartvigsson
* initial code
1
<?php
2
3
abstract class AbstractController {
4
  protected function __contructor () {
5
    
6
  }
7
  
4 by Gustav Hatvigsson
* Added FourOhFour.php
8
  public function default_method ($args) {
1 by Gustav Hartvigsson
* initial code
9
    echo "<h1>It Works!</h1>";
3 by Gustav Hatvigsson
* Made the router a class
10
    echo "<b> You should add default_method () to your class. </b>";
1 by Gustav Hartvigsson
* initial code
11
  }
12
  
13
  /**
14
   * This should return a list of method names.
15
   * 
16
   * @code{.php}
17
    function get_methods () {
18
      $ret_val = [
19
        "method_one",
20
        "method_two",
21
        ...
22
      ];
23
      
24
      return ret_val;
25
    }
26
   * @endcode
27
   */
28
  abstract public function get_methods ();
29
  
3 by Gustav Hatvigsson
* Made the router a class
30
  /*
1 by Gustav Hartvigsson
* initial code
31
   * Get the custom rout definitions.
32
   */
3 by Gustav Hatvigsson
* Made the router a class
33
  //abstract public function get_routes ();
1 by Gustav Hartvigsson
* initial code
34
  
35
  /**
36
   * load a view class.
37
   */
38
  public function load_view ($view, $user_data) {
39
    require (ROOT_DIR . "View" . DS . $view . ".php");
40
    $$view = new $view ();
41
    $$view->render ($user_data);
42
  }
43
  
44
  /**
45
   * Returns a model object
46
   */
47
  public function load_model ($model) {
48
    require (ROOT_DIR . "Model" . DS . $model . ".php");
49
    $$model = new $model ();
50
    
51
    return $$model;
52
  }
53
  
54
}