Skip to content

Pagination function? #4642

Answered by 3l3ktr0n
3l3ktr0n asked this question in Q&A Plugins
Dec 27, 2021 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

This pagination example is for displaying data per pages not as records (page vs from).

<?php

include_once('class2.php');

require_once(HEADERF);

$frm = e107::getForm();
$sql = e107::getDb();
$ns = e107::getRender();

$text = "";
$count = $sql->count('chatbox');
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$perPage = 10;
$from = ($page - 1) * $perPage;
$total = ceil($count / $perPage); 
$options = array('type' => 'page', 'navcount' => 4);

$rows = $sql->retrieve("chatbox", "cb_id, cb_nick, cb_message","LIMIT ".$from.", ".$perPage."", true);

foreach($items as $item)
{
	$text .= $item['cb_id'] ." - ".$item['cb_nick'].": ".$item['cb_message']."<br>";
}

$text = $frm->pagination(e_REQ…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@3l3ktr0n
Comment options

@Moc
Comment options

Comment options

You must be logged in to vote
1 reply
@Jimmi08
Comment options

Answer selected by Moc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment