我尝试制作导航栏。
/* Only for admin */
function getAccessRights($links) {
if ( isset($_SESSION['right']) && $_SESSION['right'] === ACCESS_ADMIN ||
isset($_COOKIE['right']) && $_COOKIE['right'] === ACCESS_ADMIN ) {
$links[] = '<li><a href="messages.phtml">Read messages</a></li>';
var_dump($links); // **Back, Login, Read messages.**
return $links;
}
}
function drawNavBar() {
if ( $_SERVER['PHP_SELF'] == "/form-msg.php" ) {
$links[] = '<li><a class="back" href="index.php">Back</a></li>';
$links[] = '<li><a href="admin.php">Login</a></li>';
getAccessRights(); // I dont know what access have user. If he have admin access, he will see link "read messages".
var_dump($links) // **Back, Login**
}
//some if
makeNavBar($links); //makeNavBar it is function which do pattern for html
}
在哪里链接“阅读消息”?也许您知道制作导航栏的更好方法。