if (!file_exists($path . $module)) { $module = $this->Config->module['error_module']; } //add specific routing rules ;D if (file_exists("{$path}{$module}/route" . Tk::$ext)) { $this->import("{$path}{$module}/route" . Tk::$ext); } //verify action information $action = isset($_GET['action']) && !empty($_GET['action']) ? $_GET['action'] : $module; $prefix = isset($this->Config->prefix['action']) ? $this->Config->prefix['action'] : ''; $file = "{$path}{$module}/{$prefix}{$action}" . Tk::$ext; if (!file_exists($file)) { $module = $this->Config->module['error_module']; $action = $prefix . $module; $file = "{$path}{$module}/{$action}" . Tk::$ext; } $_GET['module'] = $module; $_GET['action'] = $action; //verify if there is an init module $init_module = "{$path}{$this->Config->module['init_module']}/{$this->Config->module['init_filename']}" . Tk::$ext; if (file_exists($init_module)) { Tk::import($init_module); } //verify if there is an init file $init_file = "{$path}{$module}/init" . Tk::$ext; if (file_exists($init_file)) { $this->import($init_file); } $this->import($file); $this->Template->add_html($this->Config->template['content_div'], $this->Output->get_buffer()); $this->Template->render();
/** * Require and instantiate models * * @param string $model * @return void */ protected function load_model($model) { $model = isset(self::$Tk->Config->prefix['model']) && !empty(self::$Tk->Config->prefix['model']) ? self::$Tk->Config->prefix['model'] . $model : $model; if (in_array($model, Tk::$model)) { return true; } $library = Tk::$custom_model_path . $model . Tk::$ext; if (!file_exists($library)) { $library = Tk::$model_path . $model . Tk::$ext; } Tk::import($library); //verify extended models $extended_model = Tk::$custom_model_path . Tk::$extends_pref . Tk::$extends_pref . $model . Tk::$ext; if (file_exists($extended_model)) { require $extended_model; $model = $this->Tk->Config->prefix['extend'] . $model; } $obj = new $model(); Tk::$model[$model] = $model; self::$Tk->{$model} = $obj; self::$Tk->{$model}->Db = self::factory('Db'); return $obj; }