Adding A Class To <A> Tag
Results 1 to 2 of 2

Thread: Adding A Class To <A> Tag

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    93

    Adding A Class To <A> Tag

    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:

    Code:
      // 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 $i . ' ';
         }
        } // 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.

  2. #2
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,906
    Yes, add a class attribute inside the <a> element. The same way you add the href attribute.
    Last edited by Weedpacket; 11-01-2012 at 06:24 AM.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •