這里是視圖部分,在views里面創(chuàng)建了一個(gè)news文件夾,并有如下文件。
index.html
add.html
change.html
代碼分別是
index.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新聞列表頁(yè)面</title>
</head>
<body>
<table width="408" border="1">
<tr>
<td colspan="3">新聞列表</td>
</tr>
<tr>
<td width="59">序號(hào)</td>
<td width="243">標(biāo)題</td>
<td width="84">操作</td>
</tr>
<?php
foreach($news['list'] as $rows){?>
<tr>
<td width="59"><?php echo $rows['id'];?></td>
<td width="243"><?php echo $rows['title'];?></td>
<td width="84"><a href="../change/<?php echo $rows['id'];?>">修改</a><a href="../del/<?php echo $rows['id'];?>">刪除</a></td>
</tr>
<?php }
?>
<tr>
<td colspan="3">
<a href="1">首頁(yè)</a>
<a href="<?php echo $news['pageup'];?>">上頁(yè)</a>
<a href="<?php echo $news['pagedown'];?>">下頁(yè)</a>
<a href="<?php echo $news['pagemax'];?>">末頁(yè)</a>
</td>
</tr>
</table>
</body>
</html>
add.html 代碼 是
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加新聞內(nèi)容</title>
</head>
<body>
<form action="addaction" method="post">
<table width="573" border="1">
<tr>
<td colspan="2" align="center">添加內(nèi)容</td>
</tr>
<tr>
<td width="92">標(biāo)題</td>
<td width="465"><input type="text" name="title" /></td>
</tr>
<tr>
<td height="137">內(nèi)容</td>
<td><textarea name="content" rows="10" cols="50"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="確定添加" />
</td>
</tr>
</table>
</form>
</body>
</html>
change.html代碼是
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改新聞內(nèi)容</title>
</head>
<body>
<form action="../changeaction/<?php echo $id;?>" method="post">
<table width="573" border="1">
<tr>
<td colspan="2" align="center">修改內(nèi)容</td>
</tr>
<tr>
<td width="92">標(biāo)題</td>
<td width="465"><input type="text" value="<?php echo $title;?>" name="title" /></td>
</tr>
<tr>
<td height="137">內(nèi)容</td>
<td><textarea name="content" rows="10" cols="50"><?php echo $content;?></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="確定修改" />
</td>
</tr>
</table>
</form>
</body>
</html>
更多信息請(qǐng)查看IT技術(shù)專欄