Skip to content

Commit 99fe519

Browse files
committed
Add sidebar to ChangeLog rendering for navigating between versions
1 parent ce26538 commit 99fe519

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

ChangeLog-4.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -3881,4 +3881,6 @@ interface modules (Zeev)</li>
38813881
<li>First public beta of PHP 4.0</li>
38823882
</ul>
38833883

3884-
<?php site_footer(); ?>
3884+
<?php
3885+
3886+
site_footer(['sidebar' => changelog_sidebar(4)]);

ChangeLog-5.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -15957,4 +15957,6 @@ functions if "zend" is specified as the module name. (Ilia)</li>
1595715957
</ul>
1595815958
<!-- }}} --></section>
1595915959

15960-
<?php site_footer(); ?>
15960+
<?php
15961+
15962+
site_footer(['sidebar' => changelog_sidebar(5)]);

ChangeLog-7.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -10231,4 +10231,6 @@
1023110231
</ul>
1023210232
<!-- }}} --></section>
1023310233

10234-
<?php site_footer(); ?>
10234+
<?php
10235+
10236+
site_footer(['sidebar' => changelog_sidebar(7)]);

ChangeLog-8.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -753,4 +753,6 @@
753753
</ul>
754754
<!-- }}} --></section>
755755

756-
<?php site_footer();
756+
<?php
757+
758+
site_footer(['sidebar' => changelog_sidebar(8)]);

include/changelogs.inc

+12-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,15 @@ function release_date($in) {
3434
echo "<time class='releasedate' datetime='{$for_tools}'>{$human_readable}</time>";
3535
}
3636

37-
?>
37+
function changelog_sidebar(?int $current = null): string {
38+
$majors = [8, 7, 5, 4];
39+
$ret = "<div class=\"panel\">ChangeLogs<div class=\"body\"><ul>\n";
40+
foreach ($majors as $major) {
41+
if ($major === $current) {
42+
$ret .= " <li><b>PHP {$major}.x</b></li>\n";
43+
} else {
44+
$ret .= " <li><a href=\"/ChangeLog-{$major}.php\">PHP {$major}.x</a></li>\n";
45+
}
46+
}
47+
return $ret .= "</ul></body></body>\n";
48+
}

0 commit comments

Comments
 (0)