can any one help me creating a dynamic pagination script for non-sql entries
i made this simple paging script
it displays all the following:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100]
1000 Pages in total100
Can anyone help me to shorten the list of displaying page links? I want to do some like this:
[1 ][2] [3] [4][ 5] [6 ][7 ][8][ 9] [10]
and if the vistor is looking the page no 9 it should look like this
[10][11][12][13][14][15][16][17][18][19]
in short only last ten page links should be displayed instead all of 100 pages
i have searched the web and found many paging script but all of theme was for mysql
i made this simple paging script
Code:
<?php
//Show Result Per Page
$ResultPerPage=10;
//Total Result Availaible
$TotalResults =1000;
//calculate how many pages will be created
$TotalPages = $TotalResults / $ResultPerPage;
$TotalPages = round($TotalPages,0);
$c = 0;
echo "<br>";
while($c<$TotalPages){
$page = $c + 1;
if($_REQUEST['page']==$page){
echo "[$page]";
}
else{
echo "<a href=?page=$page>[$page] </a>";
}
$c = $c+1;
}
echo "<br>".$TotalResults." Pages in total".$TotalPages."<br>";
?>
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100]
1000 Pages in total100
Can anyone help me to shorten the list of displaying page links? I want to do some like this:
[1 ][2] [3] [4][ 5] [6 ][7 ][8][ 9] [10]
and if the vistor is looking the page no 9 it should look like this
[10][11][12][13][14][15][16][17][18][19]
in short only last ten page links should be displayed instead all of 100 pages
i have searched the web and found many paging script but all of theme was for mysql
Comment