Author: Aaron Junker (Aaron-Junker)
Committer: Christoph M. Becker (cmb69)
Date: 2022-07-07T13:38:02+02:00

Commit: 
https://github.com/php/web-shared/commit/b6ed0a9c95a46d9d1308e0b87f5018d2f3099c2e
Raw diff: 
https://github.com/php/web-shared/commit/b6ed0a9c95a46d9d1308e0b87f5018d2f3099c2e.diff

Highlight selected page

Closes GH-9.

Changed paths:
  M  styles/qa.css
  M  templates/header.inc


Diff:

diff --git a/styles/qa.css b/styles/qa.css
index c1988bf..94bcb68 100644
--- a/styles/qa.css
+++ b/styles/qa.css
@@ -59,4 +59,14 @@ dl a:hover {
   text-decoration: underline;
 }
 
+header nav li.active > a {
+  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
+}
+header nav li.active > a,
+header nav li.active > a:hover,
+header nav li.active > a:focus {
+  color: #fff;
+  background-color: #ff9900;
+}
+
 /* vim: set expandtab shiftwidth=2 softtabstop=2 tabstop=2 fdm=marker : */
diff --git a/templates/header.inc b/templates/header.inc
index 81a997b..ccc7525 100644
--- a/templates/header.inc
+++ b/templates/header.inc
@@ -19,6 +19,7 @@
  *                  "name"        => "input-name",
  *                  "hidden"      => array(array("name" => 
"hidden-input-name", "value" => "hidden-input-value")),
  *                ); // Search box, if any
+ *   $CURRENT_PAGE // The current page
  */
 isset($TITLE)     || $TITLE     = "Hypertext Preprocessor";
 isset($SUBDOMAIN) || $SUBDOMAIN = "";
@@ -27,6 +28,7 @@ isset($HEAD_WIKI) || $HEAD_WIKI = "";
 isset($HEAD_RAND) || $HEAD_RAND = "";
 isset($CSS)       || $CSS       = array();
 isset($SEARCH)    || $SEARCH    = array();
+isset($CURRENT_PAGE)    || $CURRENT_PAGE   = "";
 $ROOT = substr($_SERVER["SERVER_NAME"], -8) == ".php.net" ? "//shared.php.net" 
: "/shared";
 $current_time = time();
 ?>
@@ -68,7 +70,7 @@ endforeach
       <a href="/" class="home"><img 
src="//php.net/images/logo.php?<?=$SUBDOMAIN?>" width="48" height="24" 
alt="php"><span class="subdomain"><?=$SUBDOMAIN?></span></a>
       <ul>
 <?php foreach($LINKS as $link): ?>
-        <li><a href="<?=$link["href"]?>"><?=$link["text"]?></a></li>
+        <li class="<?php echo $CURRENT_PAGE == $link["text"] ? "active" : 
""?>"><a href="<?=$link["href"]?>"><?=$link["text"]?></a></li>
 <?php endforeach ?>
       </ul>
     </div>

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to