以生成首页为例:
第一步:在config.php配置文件中配置 :
'HTML_FILE_SUFFIX' => '.html', // 默认静态文件后缀
第二步:在前台(分组home)中的Index类index模块代码:
class IndexAction extends Action{
$this->display('index');
}
在模板中写入(我的模板路径是:App\Modules\Home\Tpl\Index\index.html):
<div class="main">
<h2>示例:独立分组</h2>
<div id="list" >
<volist name="list" id="vo">
{$vo.mid}--{$vo.userid}--{$vo.pwd}<br/>
</volist>
</div>
<H2>[ <A href="/index.php/admin/">后台管理</a> ]</H3>
</div>
第三步:在后台类中写入:
// 生成首页
public function createIndex(){
//对前台模板写入替换数据
$m = M('member');
$list = $m->select();
$this->assign('list',$list);
//引入模板并替换生成静态html
$this->buildHtml('index','./','Home@index/index','utf8');
$this->redirect('htmlSuccess');
}
在页面中调用createIndex 即可生成首页静态html
.................................. 截图如下 .........................................
