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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.