首页 新闻 赞助 找找看

smarty镶嵌模版怎么用

0
悬赏园豆:5 [待解决问题]

我附上我写的代码希望大侠们告诉我错误:

php文件:

<?php
include "config/connect.php";
include "config/check_login.php";
include "config/smarty_inc.php";
//同名的目录放到一组,进行分组,然后根据id进行升序排列
$sql="select f_type from oa_list group by f_type order by id";
$rs=mysql_query($sql);
//$arr_type=array();
$arr_all=array();
$arr_total=array();
$num=0;
while($rows=mysql_fetch_assoc($rs)){
$arr_total[]=$rows;
$f_sql="select * from oa_list where f_type='".$rows['f_type']."'";
$f_rs=mysql_query($f_sql);
while($f_rows=mysql_fetch_assoc($f_rs)){
if($f_rows['f_group']==0){
$bool=false;
}else{

$g_list = explode(",",$f_rows['f_group']);
//var_dump($g_list);
for($i=0;$i<count($g_list);$i++){
if($_SESSION['u_group'] == $g_list){
$bool = true;
break;
}
}
}
$f_rows['bool']=$bool;
$arr_all[]=$f_rows;


}

$arr_total[]['f_rows']=$arr_all;
unset($arr_all);
var_dump($arr_total);
//print_r($arr_total);
}
//var_dump($arr_total);
$smarty->assign('num',$num);
$smarty->assign("arr_total",$arr_total);
$smarty->display("left.html");

 

 


?>

 

html文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" />
<script src="js/client_js.js"></script>
<script language=JavaScript>
document.onclick = clickHandler;
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="203" height="509" background="images/left.jpg">
<tr>
<td width="10">&nbsp;</td>
<td height="20"></td>
</tr>
<tr>
<td>
<td align="center" valign="top">
<{section name=k1 loop=$arr_total}>
<div id=div".$num." style='position:relative; background-color:#DEEBEF; width:190; min-height:25; '>
<span id=div".<{$num}>." class = Outline style='hand:hand;'></span>
<label id=div".<{$num}>." class = Outline style='cursor:hand;'>
<img src=images/jia.gif id=div".<{$num}>."img name=div".<{$num}>."img/><{$arr_total[k1].f_type}></label>
<div id=div".$num."details style=\"display:None; position:relative; left:35;\">


<{section name=k2 loop=$arr_total[k1].f_rows}>
<{if $arr_total[k1].f_rows[k2].f_group==0}>

<img src=images/folder.gif /><U><a href='".<{$arr_total[k1].f_rows[k2].f_url}>."?u_id=".<{$arr_total[k1].arr_all[k2].id}>."' target=mainFrame>".<{$arr_total[k1].f_rows[k2].f_name>."</a></U><br/>
<{elseif $arr_total[k1].f_rows[k2].bool}>

<img src=images/folder.gif /><U><a href='".<{$arr_total[k1].f_rows[k2].f_url}>."?u_id=".<{$arr_total[k1].arr_all[k2].id}>."' target=mainFrame>".<{$arr_total[k1].f_rows[k2].f_name}>."</a></U><br/>
<{else}>
<{break}>
<{/if}>
<{/section}>


<{$num++}>
<{/section}>
</td>
</tr>
<tr>
<td colspan="2" height="54" background="images/left_top.jpg">&nbsp;</td>
</tr>
</table>
</body>
</html>

PHP
Thinking In Code的主页 Thinking In Code | 初学一级 | 园豆:197
提问于:2012-06-25 15:21
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册