Can someone please help me with this slight pagination problem I seem to be having? A few couple weeks ago I somehow managed to get this pagination script working with my site after tinkering with it for hours. But now that I have 20+ pages on my site the pagination looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Next
Whereas I'd like it to look something like this:
1 2 3 4 5 6 7 8 9 ... 19 20 Next
Can someone help figure out how to do this? If so, this is what my pagination script currently looks like.
$display = 9;
$pages = ceil($num/$display);
$current_page = $id;
if ($current_page != 1) {
echo '<a href="index.php?p=' . ($id - 1) . '">Previous</a> ';
}
for ($i = 1; $i <= $pages; $i++) {
if ($i != $current_page) {
echo '<a href="index.php?p=' . (($pages * ($i / $pages))) . '">' . $i . '</a> ';
} else {
echo $i . ' ';
}
} // End for FOR loop.
// If it's not the last page, make a next button:
if ($current_page != $pages) {
echo '<a href="index.php?p=' . ($id + 1) . '"> Next</a>';
}