ThinkPHP使用布局文件再引入文件和TITLE的设置 问题
一.我使用的是全局方法,在config已经配置了layout的设置
'LAYOUT_ON' =>true, //布局文件开启状态,默认false
'LAYOUT_NAME' =>'layout', //布局文件名称,默认layout
'TMPL_LAYOUT_ITEM' => '{__CONTENT__}',
二.这是布局文件的代码。其中title用变量去填充,头部和尾部均引用了文件
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$title}</title>
</head>
<body>
<include file="Public:header" />
{__CONTENT__}
<include file="Public:footer" />
</body>
</html>
三.默认空值的默认方法,传了title的值,并且display也写了显示的模板文件
class IndexAction extends Action{
function index(){
$title="新感觉首页";
$this->assign("title",$title);
$this->display("index");
}
}
四.模板文件目录
Tpl
Index
index.html
Public
header.html
footer.html
layout.html
问题1.layout.html引入的header和footer在index.html页面均不显示
2.layout里的title变量,在方法里assign传值过来,但是没有显示