It has been some time since I updated my pagination on my web page, and I am trying to add First and Last Links to my pagination, as well ... when the search results are long. For example, I am trying to do the following in the example below. Can someone help me fix my code so that I can update my site. Thanks
First Previous 1 2 3 4 5 6 7 ... 199 200 Next Last
Currently, my code displays the following.
Previous 1 2 3 4 5 6 7 Next
Here is part of my pagination code that displays links.
if ($pages > 1) { echo '<br /><p>'; $current_page = ($start/$display) + 1; if ($current_page != 1) { echo '<a href="index.php?s=' . ($start - $display) . '&p=' . $pages . '">Previous</a> '; } for ($i = 1; $i <= $pages; $i++) { if ($i != $current_page) { echo '<a href="index.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> '; } else { echo '<span>' . $i . '</span> '; } } if ($current_page != $pages) { echo '<a href="index.php?s=' . ($start + $display) . '&p=' . $pages . '">Next</a>'; } echo '</p>'; }
source share