Skip to content

Commit

Permalink
improve newer/older logic even more!
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdan committed Nov 13, 2018
1 parent 610fbee commit f337d2c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions post.php
Expand Up @@ -93,16 +93,13 @@
echo '<a href="stats?i=' . get_number($filename) . '">Stats For This Post</a><br><br>';

$index = array_search($filename, $files); // current index
$next = $files[$index-1];
$prev = $files[$index+1];
if (file_exists($next)) {
//print 'Next: <a href="./' . get_display_filename($next) . '">' . get_title($next) . '</a><br>';
print '<a href="./' . get_display_filename($next) . '">Newer: ' . get_title($next) . '</a><br>';
}

if (file_exists($prev)) {
//print 'Previous: <a href="./' . get_display_filename($prev) . '">' . get_title($prev) . '</a><br>';
print '<a href="./' . get_display_filename($prev) . '">Older: ' . get_title($prev) . '</a><br><br>';
if (isset($files[$index-1])) {
$next = $files[$index-1];
print '<a href="./' . get_display_filename($next) . '">Newer: ' . get_title($next) . '</a><br>';
}
if (isset($files[$index+1])) {
$prev = $files[$index+1];
print '<a href="./' . get_display_filename($prev) . '">Older: ' . get_title($prev) . '</a><br><br>';
}

} else {
Expand Down

0 comments on commit f337d2c

Please sign in to comment.