Smarty使用步骤

<?php

$adminid = $_POST['adminid'];
$passwd = $_POST['passwd'];

if($adminid=="110" && $passwd=="123")
{

/*
1:编写一个模板文件,这里学的是empList.html 通常把他存放在 templates目录下
2:下载smarty类库,并把他引入您的网站跟目录,软后配置正确,通常还新建2个文件夹,他们是
templates_c:存放模板缓存
templates :存放模板
3.引入smarty相关文件,并创建一个smarty对象,
如: require_once("lbis/include.php"); $smarty = new Smarty;
4:接着就可以使用smarty了:通常有两个方法:assign(),display()
*/
require_once("lbis/include.php");
require_once("EmpModel.php");

$empModel = new EmpModel();

$res = $empModel->showEmpList();

$smarty = new Smarty;

$smarty->assign("res",$res);

$smarty->display("empList.tpl");

// header("Location:empList.php");
}
else
{
header("Location:login.php");
}

?>

posted @ 2013-03-05 23:44  幽幽他爸  阅读(157)  评论(0编辑  收藏  举报