diff --git a/libraries/Routes.php b/libraries/Routes.php index 49e8390..d59b1d0 100644 --- a/libraries/Routes.php +++ b/libraries/Routes.php @@ -13,13 +13,30 @@ class Config { } +/*Examples +* Url: http://domain.com/ +* Url: http://domain.com/index.php/{module} +* Url: http://domain.com/index.php/{module}/app/{arg1}/{arg2} -> modules/module/controller_app.php controller($args); +*/ + function get_controller($controller, $args=[]) { if(is_file($controller)) { include_once($controller); - return call_user_func_array('controller', $args); + if(class_exists('AppController')) { + + $controller=new \AppController(); + + //return $controller->App($args); + return call_user_func_array(array($controller, 'App'), $args); + + } + else { + + return call_user_func_array('controller', $args); + } } else { @@ -181,4 +198,10 @@ class Url { } +} + +class Controller { + + + } diff --git a/modules/welcome/controllers/index.php b/modules/welcome/controllers/index.php new file mode 100644 index 0000000..fb24b27 --- /dev/null +++ b/modules/welcome/controllers/index.php @@ -0,0 +1,35 @@ + 'Cool']; + + header('Content-Type: application/json; charset=utf-8'); + + return json_encode($data); + + break; + + } + + } + +}