我写的测试方法:namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function tag(){
$this->display("tag");
}
}
tag.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<include file="tm"/>
tag 页面
</body>
</html>tm.html
<div>测试</div>
展示tag.html的时候无发导入tm页面
哪位大神指点一下什么问题啊
use Think\Controller;
class IndexController extends Controller {
public function tag(){
$this->display("tag");
}
}
tag.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<include file="tm"/>
tag 页面
</body>
</html>tm.html
<div>测试</div>
展示tag.html的时候无发导入tm页面
哪位大神指点一下什么问题啊
Include标签的源码在核心库的Template.class.php parse函数中:
public function parse($content) {
// 内容为空不解析
if(empty($content)) return '';
$begin = $this->config['taglib_begin'];
$end = $this->config['taglib_end'];
// 检查include语法
$content = $this->parseInclude($content);
'TMPL_ENGINE_TYPE' =>'Smarty',这个地方配置了smarty 这里的路径是怎么解析的
有没学习资料可以提供一下啊,我去百度都找不,哪位大神能够指导一下
或者
<include file='./Application/Home/View/index/tm.html' />
你如果启用了smarty,默认目录结构下,会由vendor下面的smarty类解释相关路径变成:
./Application/Home/View/ ---->template_dir
"./Application/Runtime/Cache/" ------>compile_dir
"./Application/Runtime/Temp/" ------->cache_dir
配置文件是这样的:
'TMPL_ENGINE_TYPE'=>'Smarty',
'TMPL_ENGINE_CONFIG'=>array(
'plugins_dir'=>'./Application/Smarty/Plugins/',
),但是导入还是不对,导入文件的时候还是会报错:Unable to load template file 'header.html' in 'Index/main.html'
其中的配置是默认设置
就像楼上说的你如果启用了smarty,默认目录结构下,会由vendor下面的smarty类解释相关路径变成:
./Application/Home/View/ ---->template_dir