Jump to content
Server Maintenance This Week. ×

Pagination active link


This topic is 3668 days old. Please don't post here. Open a new topic instead.

Recommended Posts

below is some code that i loop through records creating an unordered list. basically a table just in list form. What i want to do is in the url i have a variable being passes called page= and whatever page number i get at that time. I have a css style that when im on a specific page the pagination link that corresponds to that page should be green so i know by looking at pagination links what page im on instead of looking at the url for page number. how do i do that?

 

$n = 1;
                        while ($n <= $totalLinks and $totalLinks > 1)
                            if ($page == $n) {
                                echo '<li><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $n . '&skip=' . $skip . '&max=' . $max . '">' . $n . '</a>&nbsp;</li>';
                                $n++;
                            } else {
                                $skip = ($n - 1) * $max;
                                echo '<li><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $n . '&skip=' . $skip . '&max=' . $max . '">' . $n . '</a>&nbsp;</li>';
                                $n++;
                            }
 
The li tag thats active would be <li class="active">. Each time i click a page number on pagination links it should highlight for that page number.

figured it out my self. Sorry.. played with it and realized it was like supper simple what i did. Im learning php along with php for api for filemaker so im not familiar with it all.

Link to comment
Share on other sites

This topic is 3668 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.