Jump to content

[SOLVED] Limiting search page numbers


86Stang

Recommended Posts

I'm wanting to limit the number of page links that result from a search.  So, instead of seeing "Prev |1|2|3|4

|5|6|7|8|9|Next" etc., you would like to show only 3 pages in either direction of the current page.  I.E. if you're on page 5 you'd see "2|3|4|5|6|7|8".

 

Here's what I have and it displays ALL pages:

For($i = 1 ; $i <= $TotalNumberOfPages ; $i++)	
{	
	If($i == $CurrentPage) 
		{
			$Nav .= "<B>$i</B>";
		}
	Else
		{
			$Nav .= "<A HREF=\"search.php?page=" . $i . "&keywords=" .urlencode($keywords) . "\">$i </A>";
		}
}

 

teng84, I promise not to edit the code snippet this time! ;)

Link to comment
https://forums.phpfreaks.com/topic/86558-solved-limiting-search-page-numbers/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.