buildHtml方法测试的结果及一些问题

浏览:4072 发布日期:2013/09/13 分类:求助交流 关键字: buildHtml
TP版本为3.1.3
项目采用独立分组,后台为Admin,前台为Home
其中前台Home分组采用模板继承
Public_base.html 代码如下:<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="x-ua-compatible" content="ie=7" />
        <block name="title"><title>{$paper_title}</title></block>
        <link href="__CSS__/common.css" rel="stylesheet" />
        <link href="__CSS__/style.css" rel="stylesheet" />
        <block name="head"></block>
    </head>

    <body>
        <include file="Public:header" />
            <block name="container"></block>
            <include file="Public:footer" />
    </body>
</html>
Index_index.html继承Public_base.html 代码如下:<extend name="Public:base" />
<block name="head">
<script type="text/javascript" src="__PUBLIC__/Js/jquery.min.js"></script>
</block>
<block name="container">
<div align='center'>前台模板</div>
</block>
情况1:
在Home分组下的IndexAction.class.php控制器中,index方法如下:function index(){
    $this->buildHtml('test','./'); 
}
这种情况下可以生成test.html
问题:这样没有办法在后台Admin分组进行统一管理

在Admin分组下的IndexAction.class.php控制器中,createHtml方法如下:function createHtml(){
    $this->buildHtml('test1','./','./App/Modules/Home/Tpl/Index_index.html'); 
}
结果生成的test1.html为空,里面没有任何内容。
实验:当把Index_index.html模板中的<extend name="Public:base" />删除,则可以生成有内容的test1.html
问题:是不是extend影响模板生成的
最佳答案
评论( 相关
后面还有条评论,点击查看>>