This commit is contained in:
2024-01-29 11:56:08 +07:00
parent 507ea95304
commit d659a777f4

View File

@@ -43,11 +43,7 @@ class AppAdmin
protected function getData() {
$module_file = join(DIRECTORY_SEPARATOR, [
"data",
$this->current_route_info["module"],
str_replace("-", "_", $this->current_route_info["view"]).".php"
]) ;
$module_file = $this->getModuleFile();
if(file_exists($module_file)) {
// print_r($this->current_route_info);
@@ -71,6 +67,15 @@ class AppAdmin
}
protected function getModuleFile() {
return join(DIRECTORY_SEPARATOR, [
"data",
$this->current_route_info["module"],
str_replace("-", "_", $this->current_route_info["view"]).".php"
]) ;
}
protected function renderModule() {
if(!$this->current_route_info['module'] || !$this->current_route_info['view']) {
@@ -84,7 +89,10 @@ class AppAdmin
//check exist
if(!@file_exists( $template_file_full_path)) {
// attempt to auto create first
if(!$this->autoCreateTplFile( $template_file_path, $template_file_name )) {
// todo: this MUST BE TURNED OFF IN PRODUCTION, else many files will be created unintentionally
$module_file = $this->getModuleFile();
// only create if module file exist
if(file_exists($module_file) && !$this->autoCreateTplFile( $template_file_path, $template_file_name )) {
die("Please manually create template file at: ". $template_file_full_path);
}
}