summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Kohl <gitlab@jonaskohl.de>2024-07-21 13:23:33 +0200
committerJonas Kohl <gitlab@jonaskohl.de>2024-07-21 13:23:33 +0200
commitd79fb0f0ce4744974d45d7d4e80c3af8c2cca717 (patch)
treebf7a46b251b3047ef5704613fa93c3912427497f /src
parentd3db01ccb363db3f48695abd7dd9eef404ebc670 (diff)
Switch to more flexible params system and add active navlink state
Diffstat (limited to 'src')
-rw-r--r--src/pages/about.php3
-rw-r--r--src/pages/index.php3
-rw-r--r--src/pages/not_found.php2
-rw-r--r--src/static/nava.gifbin0 -> 1778 bytes
-rw-r--r--src/static/style.css8
-rw-r--r--src/template.php13
6 files changed, 22 insertions, 7 deletions
diff --git a/src/pages/about.php b/src/pages/about.php
index 99d8e25..9e7b31b 100644
--- a/src/pages/about.php
+++ b/src/pages/about.php
@@ -9,7 +9,8 @@ $age = date_diff(
?>
-<title>About me</title>
+<param:title>About me</param:title>
+<param:active-link>about</param:active-link>
<h1>About me</h1>
diff --git a/src/pages/index.php b/src/pages/index.php
index 3b15088..cb9b417 100644
--- a/src/pages/index.php
+++ b/src/pages/index.php
@@ -1,3 +1,4 @@
-<title>hozyro's site</title>
+<param:title>hozyro's site</param:title>
+<param:active-link>home</param:active-link>
<?php include SRCDIR . "/includes/under-construction.php"; ?>
diff --git a/src/pages/not_found.php b/src/pages/not_found.php
index b71d6c3..abe4c3f 100644
--- a/src/pages/not_found.php
+++ b/src/pages/not_found.php
@@ -1,2 +1,2 @@
-<title>Not found</title>
+<param:title>Not found</param:title>
<p>The requested page could not be found.</p>
diff --git a/src/static/nava.gif b/src/static/nava.gif
new file mode 100644
index 0000000..005f34b
--- /dev/null
+++ b/src/static/nava.gif
Binary files differ
diff --git a/src/static/style.css b/src/static/style.css
index 0b94ca4..1c1cd5e 100644
--- a/src/static/style.css
+++ b/src/static/style.css
@@ -53,6 +53,14 @@ a {
color: #05456a;
background: url("navh.gif");
}
+.navCell.active {
+ border-left-color: #000;
+ border-right-color: #7d9cb0;
+}
+.navCell.active a {
+ color: #fffca2;
+ background: url("nava.gif");
+}
#mainCell {
border: 1px solid #000;
border-top: none;
diff --git a/src/template.php b/src/template.php
index 6e2ad0c..ca781b9 100644
--- a/src/template.php
+++ b/src/template.php
@@ -1,9 +1,14 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+<?php
+
+$nav = fn(string $ln) =>
+ (($params["active-link"] ?? null) === $ln) ? ' active' : '';
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
- <title><?= htmlentities($title) ?></title>
+ <title><?= htmlentities($params["title"] ?? "") ?></title>
<link rel="stylesheet" href="/static/style.css" type="text/css" />
</head>
<body>
@@ -27,7 +32,7 @@
<table id="navLayout" cellspacing="0">
<tbody>
<tr>
- <td class="navCell" style="border-left:0">
+ <td class="navCell<?= $nav("home") ?>" style="border-left:0">
<a href="/"><img
class="navIcon"
alt=""
@@ -36,7 +41,7 @@
src="/static/icons/home.gif"
/>&nbsp;Home page</a>
</td>
- <td class="navCell">
+ <td class="navCell<?= $nav("about") ?>">
<a href="/about"><img
class="navIcon"
alt=""