0%

[技能檢定]題組一 步驟5 整理後台選單連結

在開始製作後台的功能前,因為題組素材提供的版型並不全然是正確的,所以在正式開始製作前,我們要先把一些素材的內容再做一下調整。

/back.php
選單的部份,我們會採用網址參數來切換中間功能區的內容,而網址參數是來自於使用者點選左側選單的結果。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<div id="menuput" class="dbor">
<!--主選單放此-->
<span class="t botli">後台管理選單</span>
<!--把連結都改成do=功能的型式-->
<a href="?do=title" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">網站標題管理</div>
</a>
<a href="?do=ad" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">動態文字廣告管理</div>
</a>
<a href="?do=mvim" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">動畫圖片管理</div>
</a>
<a href="?do=image" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">校園映象資料管理</div>
</a>
<a href="?do=total" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">進站總人數管理</div>
</a>
<a href="?do=bottom" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">頁尾版權資料管理</div>
</a>
<a href="?do=news" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">最新消息資料管理</div>
</a>
<a href="?do=admin" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">管理者帳號管理</div>
</a>
<a href="?do=menu" style="color:#000; font-size:13px; text-decoration:none;">
<div class="mainmu">選單管理</div>
</a>
</div>

/back.php
管理登出的按鈕,素材提供的是以 cookie 的方式來做登出,但我們這邊是採用後端 session 的方式來做登出的,所以這邊的內容會修改一下

1
2
3
4
5
6
<td>
<!--透過事件onclick,使用js指令location.href將使用者導向./api/logout.php去做登出的動作-->
<button onclick="location.href='./api/logout.php'" style="width:99%; margin-right:2px; height:50px;">
管理登出
</button>
</td>

去除用不到的內容

  1. iframe
    原素材內容是以iframe來製作類似ajax的效果,但我這邊是直接使用表單的方式來完成後台的功能,因此<iframe> 標籤可以去除,這個標籤在 index.php 中也有,可以一起去除。

    1
    <iframe style="display:none;" name="back" id="back"></iframe>
  2. 用不到的javascript
    backend.php 中放了一段 index.php 中也有的 javascript 程式,這段程式碼是前台最新消息的彈出視窗用的,後台用不到,因此建議去除,讓檔案的程式碼可以乾淨一些。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    <div id="alt" style="position: absolute; width: 350px; min-height: 100px; word-break:break-all;
    text-align:justify; background-color: rgb(255, 255, 204); top: 50px;
    left: 400px; z-index: 99; display: none; padding: 5px;
    border: 3px double rgb(255, 153, 0); background-position: initial initial;
    background-repeat: initial initial;"></div>
    <script>
    $(".sswww").hover(
    function ()
    {
    $("#alt").html(""+$(this).children(".all").html()+"").css({"top":$(this).offset().top-50})
    $("#alt").show()
    }
    )
    $(".sswww").mouseout(
    function()
    {
    $("#alt").hide()
    }
    )
    </script>