dhimo Posted July 26, 2007 Share Posted July 26, 2007 HelloHow can I make pagination navigation look like this:Prev ... 7 8 9 10 11 12 13 14 15 16 .. NextThis is what I have so far. It just loops all page numbers. for ($i = 1; $i <= $numPages; $i++) { echo " "; if ($i == $pageNum) echo "$i"; else echo "<a href=\"?page=$i\">$i</a>"; } thanks Link to comment Share on other sites More sharing options...
smartalco Posted July 26, 2007 Share Posted July 26, 2007 sorry, i hit the add reply button twice, see next post Link to comment Share on other sites More sharing options...
smartalco Posted July 26, 2007 Share Posted July 26, 2007 $i = $pageNum - 5;if ($i <= 0) $i = 1;$j = $pageNum + 5;if ($j > $numPages) $j = $numPagesif ($i > 5) echo '... ';for ($i; $i <= $j; $i++) { echo " "; if ($i == $pageNum) echo "$i"; else echo "<a href=\"?page=$i\">$i</a>"; }if($i < $numPages - 5) echo ' ...'; that should display the previous and next 5 numbers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.