Okay I have a For loop that spits out page numbers for navigation and its as follows:
[code=php] <?php
for ($page=0; $page<=$totalPages_Products; $page++) {
$label = $page + 1; // Because for some reason its starts on page 0, and that doesn’t make sense to an enduser.
$pagenum = $_GET[‘pageNum_Products’];
if ($page == $pagenum) {
$active = ‘ class=”currentpage”‘;
}
if ($_GET[‘Category’] != “”) {
$CatURL = “&Category=” . $_GET[‘Category’];
}
if ($totalPages_Products > 0) {
echo “<li><a$active href=’product-listing.php?pageNum_Products=”.$page.$CatURL.”‘>”.$label.”</a></li>”;
}
}
?>
You’ll notice this line:
[code=php]if ($page == $pagenum) {
$active = ‘ class=”currentpage”‘;
}
Here’s where I’m having the trouble, and I figure its because I’m putting this in the wrong place, but I don’t know where else to put it.
Basically what its doing wrong, is when I get to that page it will set that one to the current page class.. but then any page numbers that come after that as well.. so if there’s 4 pages, and I’m on page 2, it’ll set the current page class to 2, 3, 4 & 5…
How else can I do this, so it’ll select just 2 or whatever page its on..