update 31/01

This commit is contained in:
2024-01-31 09:34:00 +07:00
11 changed files with 362 additions and 106 deletions

View File

@@ -13,6 +13,7 @@ class AppAdmin
protected $current_route_info = [
"module" => 'home',
"view" => 'home',
"url" => '/admin/product'
];
protected $data = [];
@@ -52,10 +53,11 @@ class AppAdmin
}else{
$data = ['file data '. $module_file .' not found!'];
}
$global_data = [
"module" => $this->current_route_info['module'],
"view" => $this->current_route_info['view'],
"view" => $this->current_route_info['view'],
"url" => $this->current_route_info['url'],
"main_menu" => include_once ROOT_DIR."/data/menu.php",
];

View File

@@ -17,14 +17,16 @@ class Router {
// url: admin/abc/product.php?para1=value1
public function getRouting() {
$parsed = Url::parse($_SERVER['REQUEST_URI']); //abc/product?param1=12&param2=value2
// print_r($parsed);
// home
if($parsed['path'] == '/') {
return [
'module' => preg_replace("/[^a-z0-9_\-]/i","", getRequest('module', 'home')),
'view' => preg_replace("/[^a-z0-9_\-]/i","", getRequest('view', 'home')),
'view_id' => 0,
'view_id'=> 0,
'query' => $parsed['query'],
'url' => $parsed['path'],
];
}
@@ -58,6 +60,7 @@ class Router {
'view' => preg_replace("/[^a-z0-9_\-]/i","", $view ) ,
'view_id' => preg_replace("/[^a-z0-9_]/i","", $view_id ),
'query' => $parsed['query'],
'url' => $parsed['path'],
];
}