-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnote.php
47 lines (42 loc) · 1.05 KB
/
note.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
include 'include/context.php';
$notes = get_notes();
$count = count($notes);
$ids = array_keys($notes);
$get_id = isset($_GET['id']) ? $_GET['id'] : null;
$id = is_numeric($get_id) ? $get_id : $ids[0];
$note = $notes[$id];
foreach ($ids as $index => $key) {
if ($key == $id and $index != 0) {
$next_id = $ids[$index - 1];
}
if ($key == $id and $index != $count - 1) {
$previous_id = $ids[$index + 1];
}
}
?>
<?php include 'include/header.php'; ?>
<?php include 'include/menu.php'; ?>
<div class="main">
<div class="center">
<div class="entry">
<div class="meta">
<?php if (isset($previous_id)): ?>
<a href="/note.php?id=<?= $previous_id ?>">
Backward
</a>
<?php endif; ?>
<?php if (isset($previous_id) and isset($next_id)): ?>
<b>⁄</b>
<?php endif; ?>
<?php if (isset($next_id)): ?>
<a href="/note.php?id=<?= $next_id ?>">
Forward
</a>
<?php endif; ?>
</div>
</div>
<?php include 'include/item.php'; ?>
</div>
</div>
<?php include 'include/footer.php'; ?>