Hey, would need some help with this trick,
As for now how my script works: it queries the DB and give the output with 10 per page, and makes a pagination on the bottom of the page like 1 2 3 4 ...
With some general search terms, i get more then 200 pages returned and it goes from 1 2 ... to 200 on the bottom of the page, this isn't really nice looking, so I was wondering if I can limit the pagination to 11 pagelinks at all times, so if there 200 pages and you're on page 25 you see on the bottom of the page:
< previous 20 21 22 23 24 25 26 27 28 29 30 next>
and if you are on page 29 it would be
< previous 24 25 26 27 28 29 30 31 32 33 34 next>
leaving the current page in the middle of the pagination with 5 previous pagelinks and 5 next pagelinks. And when clicking on previous or next shifting one page. Is this possible?
This is my current pagination:
if ($count > $lperpage) {
$linkshtml .= "<p>Page: ";
if ($page > 1) $linkshtml .= "<a href=\"search.$pext?query=".urlencode($query)."&page=".($page-1)."\">$pageprev</a> ";
for ($o=1; $o<=ceil($count/$lperpage); $o++) {
if ($page == $o) $linkshtml .= "$o ";
else $linkshtml .= "<a href=\"search.$pext?query=".urlencode($query)."&page=".($o)."\">$o</a> ";
}
if ($page < ceil($count/$lperpage)) $linkshtml .= "<a href=\"search.$pext?query=".urlencode($query)."&page=".($page+1)."\">$pagenext</a> ";
$linkshtml .= "</p>";
}
any help is appreciated!
cheers
Steve