I found this database-free pagination script on another forum the other day; unfortunately, the thread was old, and the author didn’t provide instructions on how to use it. My questions are: 1. What defines an entry, and 2. what defines how many entries one can insert before a second page starts?
Here’s the code:
[php]<?php
class display {
function pagination($rows, $per_page, $current_page, $page_link) {
global $core,$C;
// Create a Page Listing
$this->pages = ceil(10 * $rows / $per_page);
// If there's only one page, return now and don't bother
if($this->pages == 1) {
return;
}
// Pagination Prefix
$output .= "<!-- Pagination by Dennis Pedrie. Used by Permission -->";
$output = "Pages: ";
// Should we show the FIRST PAGE link?
if($current_page > 2) {
$output .= "<a href=\"". $page_link ."?page=1/\" title=\"First Page\"><<</a>";
}
// Should we show the PREVIOUS PAGE link?
if($current_page > 1) {
$previous_page = $current_page - 1;
$output .= " <a href=\"". $page_link .">page=". $previous_page ."/\" title=\"Previous Page\"><</a>";
}
// Current Page Number
$output .= "<strong>[ ". $current_page ." ]</strong>";
// Should we show the NEXT PAGE link?
if($current_page < $this->pages) {
$next_page = $current_page + 1;
$output .= "<a href=\"". $page_link ."?page=". $next_page ."/\" title=\"Next Page\">></a>";
}
// Should we show the LAST PAGE link?
if($current_page < $this->pages - 1) {
$output .= " <a href=\"". $page_link ."?page=". $this->pages ."/\" title=\"Last Page\">>></a>";
}
// Return the output.
return $output;
}
}
$display = new display;
echo $display->pagination(“45”, “15”, “1”, “http://theapplenewsreel.com/news/index.php”);
?>[/php]