From e1fa15f7e42f949f48bcb96fe136555e74e1eb1f Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 26 Dec 2014 12:19:43 +0000 Subject: [PATCH] redesigned nav bar setting --- core.php | 27 ++++++++++++++++----------- settings.fragment.php | 26 +++++++++++++------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/core.php b/core.php index 71c8dcf..f6c1445 100644 --- a/core.php +++ b/core.php @@ -159,25 +159,30 @@ function renderpage($title, $content, $minimal = false) else $html .= "\t\tBrowsing as Anonymous. Login. | \n"; - foreach($navlinks as $display => $url) + foreach($navlinks as $item) { - if($display == "{search}") + if(is_string($item)) { - //output a search bar - $html .= "
"; - } - else if(strlen($url) === 0) - { - //the url has not been set, output $display directly - $html .= " " . trim($display) . " "; + //the item is a string + switch($item) + { + //keywords + case "search": //displays a search bar + $html .= "
"; + break; + + //it isn't a keyword, so just output it directly + default: + $html .= $item; + } } else { //output the display as a link to the url - $html .= "\t\t$display\n"; + $html .= "\t\t$item[0]\n"; } } - + $html .= "

$sitename

$content diff --git a/settings.fragment.php b/settings.fragment.php index 37ae832..3bc2423 100644 --- a/settings.fragment.php +++ b/settings.fragment.php @@ -42,19 +42,19 @@ $users = [ //array of links and display text to display at the top of the site $navlinks = [ - "Home" => "index.php", - "Login" => "index.php?action=login", - " | " => "", - "{search}" => "", - " | " => "", - "Read" => "index.php?page={page}", - "Edit" => "index.php?action=edit&page={page}", - "Printable" => "index.php?action=view&printable=yes&page={page}", - " | " => "", - "All Pages" => "index.php?action=list", - " | " => "", - "Credits" => "index.php?action=credits", - "Help" => "index.php?action=help" + [ "Home", "index.php" ], + [ "Login", "index.php?action=login" ], + " | ", + "search", + " | ", + [ "Read", "index.php?page={page}" ], + [ "Edit", "index.php?action=edit&page={page}" ], + [ "Printable", "index.php?action=view&printable=yes&page={page}" ], + " | ", + [ "All Pages", "index.php?action=list" ], + " | ", + [ "Credits", "index.php?action=credits" ], + [ "Help", "index.php?action=help" ] ]; //contact details for the site administrator. Since user can only be added by editing this file, people will need a contact address to use to ask for an account. Displayed at the bottom of the page, and will be appropriatly obfusticateed to deter spammers.