Jump to content

Recommended Posts

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: <a class="selected" ></a>

 

 // 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..

Link to comment
https://forums.phpfreaks.com/topic/270147-adding-a-class-to-tag/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.