Code: Select all
/****** build the pagination links - put them in function make_pagelinks() ******/
// range of num links to show
function makePagelinks()
{
$range = 10;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='http://www.mysite.com/uk/discount-vouchers.html'> <<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='http://www.mysite.com/uk/discount-vouchers-$prevpage.html'> <</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='http://www.mysite.com/uk/discount-vouchers-$x.html'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='http://www.mysite.com/uk/discount-vouchers-$nextpage.html'> ></a> ";
// echo forward link for lastpage
echo " <a href='http://www.mysite.com/uk/discount-vouchers-$totalpages.html'> >></a> ";
} // end if
}//end of function
/****** end build pagination links ******/So I put that code and then at the place on the page I want to show those links I call the function with
makePagelinks()
but as I say, see nothing, no error, just no result.