mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Template类改进layout方法
This commit is contained in:
@@ -229,9 +229,10 @@ class Template
|
|||||||
* 设置布局
|
* 设置布局
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $name 布局模板名称 false 则关闭布局
|
* @param mixed $name 布局模板名称 false 则关闭布局
|
||||||
|
* @param string $replace 布局模板内容替换标识
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function layout($name)
|
public function layout($name, $replace = '')
|
||||||
{
|
{
|
||||||
if (false === $name) {
|
if (false === $name) {
|
||||||
// 关闭布局
|
// 关闭布局
|
||||||
@@ -243,6 +244,9 @@ class Template
|
|||||||
if (is_string($name)) {
|
if (is_string($name)) {
|
||||||
$this->config['layout_name'] = $name;
|
$this->config['layout_name'] = $name;
|
||||||
}
|
}
|
||||||
|
if (!empty($replace)) {
|
||||||
|
$this->config['layout_item'] = $replace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class Think
|
|||||||
'view_suffix' => '.html',
|
'view_suffix' => '.html',
|
||||||
// 模板文件名分隔符
|
// 模板文件名分隔符
|
||||||
'view_depr' => DS,
|
'view_depr' => DS,
|
||||||
|
// 是否开启模板编译缓存,设为false则每次都会重新编译
|
||||||
|
'tpl_cache' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($config = [])
|
public function __construct($config = [])
|
||||||
|
|||||||
Reference in New Issue
Block a user