+ -
当前位置:首页 → 问答吧 → include包含模板文件该模板变量无法输出

include包含模板文件该模板变量无法输出

时间:2011-08-03

来源:互联网

index.html
...........
<!----引入内容显示模板-->
<include file="Index:content"/>


class IndexAction()
{
    .............
public function content()
{
     $title = "白宫被毁";
$this->assign('$title',$title);
$this->display();
}
}

content.html
<html>
<head>
<title>{$title}
</head>
<body>
content.........................................<br/>
</body>
</html>

运行index.html
{$title}变量无法输出.想问一下include引入外部模板是不是不进入content操作的.
有没有别的方法可以实现

作者: think_cms   发布时间: 2011-08-03

include模板是不会执行对应的方法的,模板中的变量需要在当前方法中赋值,而不是建立一个和模板相同 的方法赋值

作者: lscgzwd   发布时间: 2011-08-03

热门下载

更多