我是一个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");
?>