First | Prev | -Pages- | Next | Last
and I need
First | Prev 20 | -Pages- | Next 20 | Last
and only shows me 20 pages at a time this is the code for the one i am working with
Code: Select all
//how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
if ($maxPage == null){
echo "
<body text='#FF0000' bgcolor='#000000'> No items to show at this time, Please check back.";
}
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " <font size='4' face='Arial' color='#008000'></font> "; // no need to create a link to current page
}
else
{
$nav .= " <font size='4' face='Arial' color='#B68425'><a href=\"$self?page=$page&search=$search\">$page</a></font> ";
}
}
//////////////////////////////////////////////////////////////////////////
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <font size='3' face='Arial' color='#008000'><a href=\"$self?page=$page&search=$search\">[Prev]</a></font> ";
$first = "<font size='3' face='Arial' color='#008000'><a href=\"$self?page=1&search=$search\">[First Page]</a></font> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <font size='3' face='Arial' color='#B68425'><a href=\"$self?page=$page&search=$search\">[Next]</a></font> ";
$last = " <font size='3' face='Arial' color='#B68425'><a href=\"$self?page=$maxPage&search=$search\">[Last Page]</a></font> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
///////////////////////////////////////////////////////
// print the navigation link
echo $first . $prev . $nav . $next . $last;any help would be great