后端模块更新
前端模板路径设置
This commit is contained in:
@@ -6,10 +6,32 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller;
|
||||
namespace app\controller\front;
|
||||
|
||||
use \app\Base as BaseC;
|
||||
use think\facade\View;
|
||||
use think\facade\Cache;
|
||||
use \app\controller\Base as BaseC;
|
||||
|
||||
class Base extends BaseC {
|
||||
|
||||
|
||||
protected function fetch($template = '') {
|
||||
$config = Cache::get('system_config_data');
|
||||
$this->tpl_config['view_depr'] = '_';
|
||||
$pc_themes = $config['pc_themes'] ? $config['pc_themes'] . DIRECTORY_SEPARATOR : "";
|
||||
$this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $pc_themes;
|
||||
if ($this->isMobile() && $config['mobile_themes']) {
|
||||
$mobile_themes = $config['mobile_themes'] ? $config['mobile_themes'] . DIRECTORY_SEPARATOR : "";
|
||||
$this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $mobile_themes;
|
||||
if (!is_dir($this->app->getRootPath() . $this->tpl_config['view_dir_name'])) {
|
||||
$this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $pc_themes;
|
||||
}
|
||||
}
|
||||
if ($template == '') {
|
||||
$template = str_replace(".", "@", strtolower($this->request->controller())) . "/" . $this->request->action();
|
||||
}
|
||||
|
||||
View::config($this->tpl_config);
|
||||
View::assign($this->data);
|
||||
return View::fetch($template);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace app\controller\front;
|
||||
use \app\model\Form;
|
||||
|
||||
|
||||
class Front extends Base {
|
||||
class Index extends Base {
|
||||
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
|
||||
Reference in New Issue
Block a user