Revision: 13827
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 7, 2009 09:35 by fackz
Initial Code
<?php
function dopages($curent_page, $totalcontent, $perpage){
$totalpages = $totalcontent / $perpage;
if($curent_page !== 1){
$preid = $curent_page - 1;
$output .= '<a href="'.$preid.'">Previous</a> ';
}
while ( $counter <= $totalpages ) {
if($counter == $curent_page){
$output .= '<a href="'.$counter.'"><b>'.$counter.'</b></a> ';
}else {
$output .= '<a href="'.$counter.'">'.$counter.'</a> ';
}
$counter = $counter + 1;
}
if($curent_page !== $totalpages){
$neid = $curent_page + 1;
$output .= '<a href="'.$neid.'">Next</a> ';
}
return $output;
}
?>
//usage
<? echo dopages(1, 80, 20); ?>
Initial URL
Initial Description
Couldent find a pre-made function with a simple pagination. $curent_page Is what page number you are currently on. $totalcontent Is how many rows you have in your database $perpage Is how many rows you display per page.
Initial Title
simple pagination
Initial Tags
Initial Language
PHP