From d092b634576730fc2ead1dc4c88711da09415f75 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 12 Sep 2017 02:19:31 +0200 Subject: [PATCH] page: replace links to current page in menu include Replaces similar client-side javascript on Excelsior for direct/static results. --- head.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/head.inc.php b/head.inc.php index 5e19024..2522ad7 100644 --- a/head.inc.php +++ b/head.inc.php @@ -2,7 +2,16 @@ include_once 'head.inc.html'; print "
\n"; + +ob_start(); include 'menu.html'; +$nav = ob_get_clean(); +$nav = preg_replace_callback('{(.*?)}', function ($m) { + $request = $_SERVER['REQUEST_URI']; + $html = $request == $m[1] ? $m[2] : $m[0]; # text or full link + return $m[1] == substr($request, 0, strlen($m[1])) ? "$html" : $html; +}, $nav); +print $nav; print "
\n\n"; print '
'."\n\n"; -- 2.30.0