mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 16:12:49 +08:00
tpl_path tpl_prefix 配置参数统一为view_path view_prefix
This commit is contained in:
@@ -22,8 +22,8 @@ class Template
|
||||
protected $data = [];
|
||||
// 引擎配置
|
||||
protected $config = [
|
||||
'tpl_path' => '', // 模板路径
|
||||
'tpl_suffix' => '.html', // 默认模板文件后缀
|
||||
'view_path' => '', // 模板路径
|
||||
'view_suffix' => '.html', // 默认模板文件后缀
|
||||
'cache_suffix' => '.php', // 默认模板缓存后缀
|
||||
'tpl_deny_func_list' => 'echo,exit', // 模板引擎禁用函数
|
||||
'tpl_deny_php' => false, // 默认模板引擎是否禁用PHP原生代码
|
||||
@@ -57,14 +57,11 @@ class Template
|
||||
public function __construct(array $config = [])
|
||||
{
|
||||
$this->config['cache_path'] = RUNTIME_PATH . 'temp' . DS;
|
||||
$this->config = array_merge($this->config, empty($config) ? (array) Config::get('template') : $config);
|
||||
$this->config = array_merge($this->config, empty($config) ? Config::get() : $config);
|
||||
$this->config['taglib_begin'] = $this->stripPreg($this->config['taglib_begin']);
|
||||
$this->config['taglib_end'] = $this->stripPreg($this->config['taglib_end']);
|
||||
$this->config['tpl_begin'] = $this->stripPreg($this->config['tpl_begin']);
|
||||
$this->config['tpl_end'] = $this->stripPreg($this->config['tpl_end']);
|
||||
if (empty($this->config['tpl_path']) && defined('VIEW_PATH')) {
|
||||
$this->config['tpl_path'] = VIEW_PATH;
|
||||
}
|
||||
|
||||
// 初始化模板编译存储器
|
||||
$type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File';
|
||||
@@ -366,7 +363,7 @@ class Template
|
||||
$array = $this->parseAttr($matches[0]);
|
||||
//if (!C('LAYOUT_ON') || C('LAYOUT_NAME') != $array['name']) {
|
||||
// 读取布局模板
|
||||
$layoutFile = (defined('THEME_PATH') && substr_count($array['name'], '/') < 2 ? THEME_PATH : $this->config['tpl_path']) . $array['name'] . $this->config['tpl_suffix'];
|
||||
$layoutFile = (defined('THEME_PATH') && substr_count($array['name'], '/') < 2 ? THEME_PATH : $this->config['view_path']) . $array['name'] . $this->config['view_suffix'];
|
||||
if (is_file($layoutFile)) {
|
||||
$replace = isset($array['replace']) ? $array['replace'] : $this->config['layout_item'];
|
||||
// 替换布局的主体内容
|
||||
@@ -939,8 +936,8 @@ class Template
|
||||
if (false === strpos($template, '.')) {
|
||||
// 跨模块支持
|
||||
$template = strpos($template, '@') ?
|
||||
APP_PATH . str_replace('@', '/' . basename($this->config['tpl_path']) . '/', $template) . $this->config['tpl_suffix'] :
|
||||
(defined('THEME_PATH') && substr_count($template, '/') < 2 ? THEME_PATH : $this->config['tpl_path']) . $template . $this->config['tpl_suffix'];
|
||||
APP_PATH . str_replace('@', '/' . basename($this->config['view_path']) . '/', $template) . $this->config['view_suffix'] :
|
||||
(defined('THEME_PATH') && substr_count($template, '/') < 2 ? THEME_PATH : $this->config['view_path']) . $template . $this->config['view_suffix'];
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user