c
This commit is contained in:
@@ -73,6 +73,10 @@ class AppAdmin
|
|||||||
|
|
||||||
protected function renderModule() {
|
protected function renderModule() {
|
||||||
|
|
||||||
|
if(!$this->current_route_info['module'] || !$this->current_route_info['view']) {
|
||||||
|
die("Module not exist");
|
||||||
|
}
|
||||||
|
|
||||||
$template_file_path = $this->tpl_path ."/". $this->current_route_info['module'];
|
$template_file_path = $this->tpl_path ."/". $this->current_route_info['module'];
|
||||||
$template_file_name = $this->current_route_info['view'].".html";
|
$template_file_name = $this->current_route_info['view'].".html";
|
||||||
$template_file_full_path = $template_file_path."/".$template_file_name;
|
$template_file_full_path = $template_file_path."/".$template_file_name;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check match pattern in $this->path_config
|
// check match pattern in $this->path_config
|
||||||
foreach ($this->path_config as $_config => $_route ) {
|
/*foreach ($this->path_config as $_config => $_route ) {
|
||||||
if(preg_match("{^".$_config."$}", $parsed['path'], $match )) {
|
if(preg_match("{^".$_config."$}", $parsed['path'], $match )) {
|
||||||
|
|
||||||
if(isset($_route['query']) && is_array($_route['query'])) {
|
if(isset($_route['query']) && is_array($_route['query'])) {
|
||||||
@@ -43,16 +43,20 @@ class Router {
|
|||||||
'match' => $match,
|
'match' => $match,
|
||||||
], $_route);
|
], $_route);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// auto parse path base on convention: admin/module/view/view_id
|
// auto parse path base on convention: admin/module/view/view_id
|
||||||
$ele = explode("/", $parsed['path']);
|
$ele = explode("/", $parsed['path']);
|
||||||
|
|
||||||
|
$module = $ele[2] ?? 'home';
|
||||||
|
$view = isset($ele[3]) ? $ele[3] : getRequest('view', 'home');
|
||||||
|
$view_id = isset($ele[4]) ? $ele[4] : getRequest('id', 'view_id');
|
||||||
|
|
||||||
// else error
|
// else error
|
||||||
return [
|
return [
|
||||||
'module' => $ele[2] ?? 'home',
|
'module' => preg_replace("/[^a-z0-9_\-]/i","", $module ) ,
|
||||||
'view' => isset($ele[3]) ? preg_replace("/[^a-z0-9_\-]/i","", $ele[3] ) : 'home',
|
'view' => preg_replace("/[^a-z0-9_\-]/i","", $view ) ,
|
||||||
'view_id' => isset($ele[4]) ? preg_replace("/[^a-z0-9_]/i","", $ele[4] ) : '',
|
'view_id' => preg_replace("/[^a-z0-9_]/i","", $view_id ),
|
||||||
'query' => $parsed['query'],
|
'query' => $parsed['query'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user