lear_all_cache();//Alle Caches löschen
//smarty.php
//HTML-Datei erstellen und Smarty-Vorlage verwenden
//Rossy.cn@gmial.com
//2007-07-27 11: 15
require_once("classes/Smarty.class.php"); //smarty文件
require_once("config.php"); //Weitere Informationen
require_once("mysql_class.php"); //数据库连接文件
$smarty = new Smarty();
$smarty->template_dir = "templates";
$smarty->compile_dir ="templates_c";
$smarty->left_delimiter = "<{";
$smarty->right_delimiter ="}>";
$page_count = "3"; //每一页的记录数
$Db = new Mysql;
$query = $Db->Query("Select * FROM Tablea orDER BYID DESC");
$tatol = $Db- >FetchCount($query);
$pages = ceil($tatol / $page_count);
for ($j=1;$j<=$pages;$j++)
$showpages.= "
for ($i = 0;$i<$pages; $i++)
{
$start_page = $i *$page_count;
if($pages>1)
{
$indexpath ="user_".($i+1).".htm"; //Dateiname
$showpagestr= "
}
else
{
$indexpath = "user.htm"; //Dateiname
$showpagestr= "";
}
$sql = "Select * FROM TableaorDER BY ID DESC LIMIT $start_page,$page_count";
$query =$Db ->Query($sql) or die("Invalid Query");
if(($Db->FetchCount($query))<1){
$Admin ="數據庫沒有此數據";
}else{
while ($rs =$Db->FetchArray($query)) {
$Admin[] =array('Id'=>$rs['Id' ],'Name'=>$rs['Name'],'Nick'=>$rs['Benutzername'],'Type'=>$rs['Type'],'Email'=> $rs['Email']);
}
}
$smarty->assign(array('Site_Name'=>"系统",'AdminName'=>'ybfqlyq ','AdminType'=>'Administrator','Type'=>'1'));
$smarty->assign('Admin',$Admin);
$smarty-> Assign('Page_Str',$showpagestr);
$temp =$smarty->fetch('test.tpl', null, null, false);//模板文件
unset($Admin);
$showpagestr = "";
$fp=fopen($indexpath,'w');
fwrite($fp,$temp) ordie('create failed');
}
$Db->Close();
echo "HTM-Datei erfolgreich erstellen";
?>
test.tpl文件代码:
href ="templates/css.css" type=text/cssrel=stylesheet>
cellSpacing=0 cellPadding=2 width="100%"align=center border=1>
編號
用戶名
姓名
類別
郵件地址
<{sectionname=adminlist loop=$Admin}>
<{/section}>
<{$Page_Str}>