Content.exe
Pagenate an array into a table using PHP.
This is a basic example and has been depreciated, a far more advanced and upto date example can be found here.
(Thanks to Andrew (Morf) for his help on this)
To see it in action click here
There are user configurable values at the top, such as query name, and number of results per page etc, the important thing to remember though, is the page link must be correct
$val){
$args.= $key!=$queryString ? "&".$key."=".$val : "" ;
}
if($all>0){
if(($listing+1) > $all_pages){$listing=0;}
$of = 0;
////////////////////////////////////////// navigation starts
if(($listing+1) > 1 && ($listing+1) <= $all_pages){
// up
echo '«';
}
if ($all_pages>1){
// goto page
for($i=0;$i<$all_pages;$i++){
// echo`s the number also checks to see if this is the current page
echo $listing==$i ? ''.($i+1).'' : ''.($i+1).'';
if($i < ($all_pages-1)) echo ' | ';
}
}
if(($listing+1) < $all_pages){
// down
echo ' »';
}
///////////////////////////////////////// navigation ends
?>
Thing 1
Thing 2
Thing 3
No results found';
}
?>
You can download the complete zipped file here
I have now developed a fully automated function here which is far superior.
2 responses to “Pagenation with php example”