foto: common override of navigation root title
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Feb 2019 22:38:53 +0000 (23:38 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Feb 2019 22:48:48 +0000 (23:48 +0100)
Slight code simplification.

foto/index.php

index f77b9c18414e1553e698e8a63e7ffd28b9b67423..cd939f3ab2e5e92ba73fbeff02dc0946ef24952a 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 $intro = ob_get_clean();
 
-$rootdir = 'foto' . $Args;
+$rootdir = $Page . $Args;
 
 if (!empty($User['admin'])) {
        $access = '🔓 Openbaar';
        if (isset($PageAccess)) {
                $access = "🔒 Bewoners";
-               if ($PageAccess != $Page.$Args) {
+               if ($PageAccess != $rootdir) {
                        $access .= sprintf(' vanaf <a href="%s">%s</a>',
                                "/$PageAccess", pathinfo($PageAccess, PATHINFO_FILENAME)
                        );
@@ -16,16 +16,17 @@ if (!empty($User['admin'])) {
        print "<aside>$access</aside>\n\n";
 }
 
-$nav = explode('/', $Page.$Args);
+$nav = explode('/', $rootdir);
+$nav[0] = "Foto's"; # override of root 'foto'
 $title = array_pop($nav);
-$rootname = "Foto's"; # override of 'foto'
+
 $link = '';
 print "<h2>";
 foreach ($nav as $i => $linktitle) {
-       $link .= "/$linktitle";
-       printf('<a href="%s">%s</a> â†’'."\n", $link, $i ? $linktitle : $rootname);
+       $link .= '/' . ($i ? $linktitle : $Page);
+       printf('<a href="%s">%s</a> â†’'."\n", $link, $linktitle);
 }
-print $Args ? $title : $rootname;
+print $title;
 print "</h2>\n\n";
 
 print $intro;