Jump to content
Larry Ullman's Book Forums

Ghamdan

Members
  • Posts

    55
  • Joined

  • Last visited

Posts posted by Ghamdan

  1. // Make the links to other pages:

    if($pages > 1) {

    echo ' <p id="pagination"> <span class="current"> ';

    $current_page = ($start/$display) + 1 .' </span>';

     

     

    // If it is not the first page, make a previous link:

    if($current_page != 1) {

    echo ' <a href="view_users.php?s=' . ($start - $display).'&p=' . $pages . '&sort='. $sort . ' "> Previous </a> ';

     

    }

    // Make all the numbered pages:

    for($i = 1; $i<= $pages; $i++) {

    if($i != $current_page) {

    echo ' <a href="view_users.php?s=' . (($display *($i - 1) )). '&p=' . $pages .'&sort='. $sort .' ">' . $i . ' </a> ';

     

    } else {

     

    echo $i . '';

    }

    }// End of FOR loop.

    // If it is not the last page, make a next button:

    if($current_page != $pages) {

    echo ' <a href="view_users.php?s=' . ($start + $display) . '&p='. $pages . '&sort=' . $sort . ' "> Next </a> ';

    }

     

    echo ' </p>';

     

    }// End of links section.

  2. I am practisng how to create pagination in chapter 10 - page: 317 and I want to add class to the current page so I can style it using CSS.

    When I try to add a class, or use float in CSS, I run into a problem.

    Can you help me solve this problem?

    Excerpt of the colde:

     

     

    // Make the links to other pages:

    if($pages > 1) {

    echo ' <p id="pagination"> ';

    $current_page = ($start/$display) + 1 ;

     

     

    // If it is not the first page, make a previous link:

    if($current_page != 1) {

    echo ' <a href="view_users.php?s=' . ($start - $display).'&p=' . $pages . '&sort='. $sort . ' "> Previous </a> ';

     

    }

    // Make all the numbered pages:

    for($i = 1; $i<= $pages; $i++) {

    if($i != $current_page) {

    echo ' <a href="view_users.php?s=' . (($display *($i - 1) )). '&p=' . $pages .'&sort='. $sort .' ">' . $i . ' </a> ';

     

    } else {

     

    echo $i . '';

    }

    }// End of FOR loop.

    // If it is not the last page, make a next button:

    if($current_page != $pages) {

    echo ' <a href="view_users.php?s=' . ($start + $display) . '&p='. $pages . '&sort=' . $sort . ' "> Next </a> ';

    }

     

    echo ' </p>';

     

    }// End of links section.

     

    =====================================

    Thank you

    Ghamdan

×
×
  • Create New...