Jump to content

Pagination navigation


dhimo

Recommended Posts

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

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...