PHP访问MySql数据库 中级篇 Smarty技术(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-20 18:32 点击:次
{foreach $db_coltitle as $col}
<th>{$col}</th>
{/foreach}
{foreach $db_rows as $dbrow}
<tr>
{foreach $dbrow as $k=>$val}
<td>{$val}</td>
{/foreach}
</tr>
{/foreach}
</table>
</body>
</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>
<link href="smarty2.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="../jquery-1.7.min.js"></script>
<script type="text/javascript" src="smarty2.js"></script>
<title>{$smarty.const.DB_TABLENAME}</title>
</head>
<body>
<h1>表中有{$db_count}条记录</h1>
<table border="1" align="center" cellpadding="10" cellspacing="2" bordercolor="#ffaaoo">
{foreach $db_coltitle as $col}
<th>{$col}</th>
{/foreach}
{foreach $db_rows as $dbrow}
<tr>
{foreach $dbrow as $k=>$val}
<td>{$val}</td>
{/foreach}
</tr>
{/foreach}
</table>
</body>
</html>
4.smarty2.js文件
$(document).ready(function()
{
//用CSS控制奇偶行的颜色
$("table tr:odd").css("background-color", "#e6e6fa");
$("table tr:even").css("background-color", "#fff0fa");
});
$(document).ready(function()
{
//用CSS控制奇偶行的颜色
$("table tr:odd").css("background-color", "#e6e6fa");
$("table tr:even").css("background-color", "#fff0fa");
});
5.smarty2.css文件
@charset "utf-8";
h1
{
color:Red;
text-align:center;
}
table th
{
background-color:#7cfc00;
}
@charset "utf-8";
h1
{
color:Red;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>