Hi all,
with the searchfunction on my website my script breaks up the results into pages with 10 results. You can click the other pagenumbers to visit the next pages. Now the problem is when I have for example 200 results, it will show the pagenumbers 1 till 20. That's not so good, I only want like 10 pagenumbers like Google uses. This is the code:
Could you please help me to fix this? If it isn't clear what I want, please see the pagenumbers by Google for a better explanation
Thank you!
with the searchfunction on my website my script breaks up the results into pages with 10 results. You can click the other pagenumbers to visit the next pages. Now the problem is when I have for example 200 results, it will show the pagenumbers 1 till 20. That's not so good, I only want like 10 pagenumbers like Google uses. This is the code:
Code:
print "<table width='728' border=0 background='/images/categorie-onder728.gif' height='25' cellpadding='0' cellspacing='0'><tr><td class=bodytext align='right'>";
my $searchenc = $search;
$searchenc =~ s/([\W])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
$pagecount = $countresults / $linksperpage; # break the pages down
if ($pagecount =~ m/\./) {$pagecount = int ($pagecount + 1)}
$view_page = $q->param("page");
if ($view_page) {$page = $view_page} else {$page = 1}
print "<font color='#ffffff'>[ $mltext5 </font>";
for ($page_count = 1; $page_count <= $pagecount; $page_count++) {
if ($page_count == $page) {
print "<b><font color='#ffffff'> $page_count</font></b> ";
} else {
print "<a href=\"$searchscript?search=$searchenc&page=$page_count\">$page_count</a> ";
}
}
print "<font color='#ffffff'>]</font></td><td width='2'></td></tr></table><br>";
Could you please help me to fix this? If it isn't clear what I want, please see the pagenumbers by Google for a better explanation
Thank you!