0%

[技能檢定]題組一 步驟16 製作後台訪客計數器及頁尾版權文字管理

建立訪客計數器畫面

修改原本的後台頁面內容,整理成符合題意的畫面

撰寫表單內容

在類別中建立後台頁面需要的參數
/Controller/Total.php

1
2
3
4
5
6
7
function backend(){
$view=['header'=>'進站總人數管理',
'table'=>$this->table,
'total'=>$this->find(1)['total'],
];
return $this->view('./view/backend/total.php',$view);
}

建立一個可供修改的表單
/view/backend/total.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div style="width:99%; height:87%; margin:auto; overflow:auto; border:#666 1px solid;">
<p class="t cent botli"><?=$header;?></p>
<form method="post" action="./api/update_single.php">
<table width="50%" style="margin:auto">
<tr class="yel">
<td width="50%">進站總人數:</td>
<td width="50%">
<input type="number" name="total" value="<?=$total;?>">
</td>
</tr>
</table>
<table style="margin-top:40px; width:70%;">
<tr>
<td width="200px"></td>
<td class="cent">
<input type="hidden" name='table' value='<?=$table;?>'>
<input type="submit" value="修改確定">
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
</div>

建立頁尾版權文字畫面

可以複製訪客計數器的頁面內容,修改成頁尾版權頁的內容

撰寫表單內容

在類別中建立後台頁面需要的參數
/Controller/Bottom.php

1
2
3
4
5
6
7
function backend(){
$view=['header'=>'頁尾版權資料管理',
'table'=>$this->table,
'bottom'=>$this->find(1)['bottom'],
];
return $this->view('./view/backend/bottom.php',$view);
}

建立一個可供修改的表單
/view/backend/bottom.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div style="width:99%; height:87%; margin:auto; overflow:auto; border:#666 1px solid;">
<p class="t cent botli"><?=$header;?></p>
<form method="post" action="./api/update_single.php">
<table width="50%" style="margin:auto">
<tr class="yel">
<td width="50%">頁尾版權資料:</td>
<td width="50%">
<input type="text" name="bottom" value="<?=$bottom;?>">
</td>
</tr>
</table>
<table style="margin-top:40px; width:70%;">
<tr>
<td width="200px"></td>
<td class="cent">
<input type="hidden" name='table' value='<?=$table;?>'>
<input type="submit" value="修改確定">
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
</div>