請用BootStrap5產生導覽列,需要三個連結選項:首頁、產生內嵌語法、發布新聞
導覽列不需要出現品牌,選項前面加入適合的Font Awesome 圖示。
右邊需要一個搜尋框,搜尋按鈕不要出現文字請用 Font Awesome 圖示取代
搜尋框部份請加上表單,用GET方法送至index.php
templates/nav.tpl
index.php
」;index.php?op=embed
」;admin.php
」,因為到時候要做一點簡單的加密處理,所以和 index.php
分開為宜op
只是我們自行命名的參數(可以改),之後會用他來讓程式知道該執行什麼動作
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.php">
<i class="fas fa-home me-1"></i>首頁
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php?op=embed">
<i class="fas fa-code me-1"></i>產生內嵌語法
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="admin.php">
<i class="fas fa-newspaper me-1"></i>發布新聞
</a>
</li>
</ul>
<form class="d-flex" action="index.php" method="GET">
<input class="form-control me-2" type="search" placeholder="搜尋" aria-label="Search" name="search">
<button class="btn btn-outline-success" type="submit">
<i class="fas fa-search"></i>
</button>
</form>
</div>
</div>
</nav>
templates\meta.tpl
,加入 Font Awesome 的 CDN 連結。
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{$webTitle}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">