Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula to Format Search Results 1

Status
Not open for further replies.

kennygadams

Programmer
Jan 2, 2005
94
US
I'm trying to create navigation feature similar to what tek-tips.net did with theirs:

Example: « ‹ 5 6 7 8 9 [10] 11 12 13 14 › »

You can view my progress here:

Currently it is displaying links to the all the results pages but I want it to display about four links before and after the current page that the visitor is viewing. What would be some good ways of doing that?

Code:
$number_of_pages = '3319';
$page_counter = '0';
while($page_counter < $number_of_pages){
	$page_counter++;
	if($page_counter == $current_page_number){
		$navigation_text .= " &nbsp; <b>($page_counter)</b> &nbsp; ";
		}
	else{
		$navigation_text .= " &nbsp; <a href='[URL unfurl="true"]http://www.jesterartsillustrations.com/cgi-bin/test-select.pl?page=$page_counter'>$page_counter</a>[/URL] &nbsp; ";	
		}
	}

Kenny
 
Code:
my $min = $current -4;
my $max = $current +4;
$min = 0       if ($min < 0);
$max = limit-1 if ($max >= $total)'
for (my $pageno = $min; $pageno < $max; $pageno++) {
  create_link($pageno);
}

Something along those lines might be the kind of thing you're looking for.


Trojan.
 
You rock! [rockband] Thanks for pointing me in the rigth direction.

Kenny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top