pager
This commit is contained in:
parent
0a7e99becd
commit
a74b3ef90b
1 changed files with 15 additions and 4 deletions
|
@ -28,6 +28,8 @@
|
||||||
page_header();
|
page_header();
|
||||||
|
|
||||||
$form_message = post_handler();
|
$form_message = post_handler();
|
||||||
|
|
||||||
|
$page = array_key_exists('page',$_GET) ? ($_GET['page']) : 0;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="banner"><img class="banner-background" src="/img/newlogo.svg">
|
<div class="banner"><img class="banner-background" src="/img/newlogo.svg">
|
||||||
|
@ -44,16 +46,25 @@
|
||||||
<a class="form-button" href="https://git.dervland.net/biglyderv/new-bigly-chat">Developer Portal</a>
|
<a class="form-button" href="https://git.dervland.net/biglyderv/new-bigly-chat">Developer Portal</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($username) {
|
if ($username) {
|
||||||
form("Broadcast your thoughts...", $form_message, array(
|
form("Broadcast your thoughts...", $form_message, array(
|
||||||
array('key' => 'Your message', 'type' => 'textarea', 'name' => 'post', 'default' => '')
|
array('key' => 'Your message', 'type' => 'textarea', 'name' => 'post', 'default' => '')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
$stmt = $db->prepare("SELECT * FROM comment ORDER BY date DESC");
|
|
||||||
$stmt->execute([]);
|
<div>
|
||||||
|
<a class="form-button" href="?page=<?php echo $page - 1 ?>">Previous</a>
|
||||||
|
<a class="form-button" href="?page=<?php echo $page + 1 ?>">Next</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$stmt = $db->prepare("SELECT * FROM comment ORDER BY date DESC LIMIT ? OFFSET ?");
|
||||||
|
$stmt->execute([
|
||||||
|
10,
|
||||||
|
$page * 10
|
||||||
|
]);
|
||||||
|
|
||||||
$posts = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$posts = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue