Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:07:49+00:00 2026-06-13T17:07:49+00:00

this code I used to display paginating links… problem is I need to add

  • 0

this code I used to display paginating links… problem is I need to add some style to the links when its active.. I can style it through some CSS rules.. but at first need to add a class to link tag.. Eg:

    // Make the links to other pages, if necessary.
    if ($pages > 1) {

        echo '<div class="pagination">';            
            echo '<p>';

            // Determine what page the script is on:
            $current_page = ($start/$display) + 1;

            // If it's not the first page, make a Previous link:
            if ($current_page != 1) {
                echo '<a href="searching.php?s=' . ($start - $display) . '&p=' . $pages . '"><</a>';
            }

            // Make all the numbered pages:
            for ($i = 1; $i <= $pages; $i++) {
                if ($i != $current_page) {
                    echo '<a href="searching.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> ';
                } else {
                    echo '<a class="current" href="#">' . $i . '</a> '; // Link to # so that it is not clickable.
                }
            } // End of FOR loop.           

            // If it's not the last page, make a Next button:
            if ($current_page != $pages) {
                echo '<a href="searching.php?s=' . ($start + $display) . '&p=' . $pages . '">></a>';
            }

            echo '</p>'; // Close the paragraph.

        echo '</div>';

    } // End of links section.  

can anybody have any idea how to do this?

thank you..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:07:50+00:00Added an answer on June 13, 2026 at 5:07 pm

    Replace <a href=" with something like <a class="current" href=".

    So, you would be effectively needing this CSS, as I assume that you will be having a current page at a time, plus normal page links, and previous and next buttons:

    <div class="pagination">
        <a href="#" class="prev">Previous</a>
        <a href="#">1</a>
        <a href="#" class="current">2</a>
        <a href="#">3</a>
        <a href="#" class="next">Next</a>
    </div>
    

    Wrap with a div with a class pagination, so that you can better style it. Now for the styles, you can use a CSS something like this:

    .pagination {margin: 5px;} /* Give some margin */
    .pagination a {color: #09f; text-decoration: none;} /* Give color, remove underline */
    .pagination a:hover {font-weight: bold;} /* Effect when mouse over */
    .pagination a.prev, .pagination a.next {color: #06f;} /* Let previous and next be in different color*/
    .pagination a.current {color: #000; font-weight: bold;} /* Black and bold! */
    

    Screenshot:

    This would look this way:

    Screenshot

    Fiddle: http://jsfiddle.net/3Z9Jk/

    To change in your code:

    for ($i = 1; $i <= $pages; $i++) {
     if ($i != $current_page) {
      echo '<a href="searching.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> ';
     } else {
      echo '<a class="current" href="#">' . $i . '</a> '; // Link to # so that it is not clickable.
     }
    }
    

    Please change these:

    1.

    if ($current_page != 1) {
        echo '<a class="prev" href="searching.php?s=' . ($start - $display) . '&p=' . $pages . '"><</a>';
    }
    

    2.

    if ($current_page != $pages) {
        echo '<a class="next" href="searching.php?s=' . ($start + $display) . '&p=' . $pages . '">></a>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display webview in cocos2D game. I used this code. But it
I read this code in a library which is used to display a bitmap
I used this code to read the data from log files and display in
This code can be used to select the first ten records from a table
I used this code from the code project in order to display a .png
I have the following code used to display some user information as well as
I'm doing pagination with will_paginate and used the code to style my pagination links
This code used to return my local ip address as 192.xxx.x.xxx but now it
This code used to work but doesnt any more. i used a breakpoint, and
This code used to work. Then, maybe I changed something, somewhere (or if I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.