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..
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
currentpage at a time, plus normal page links, and previous and next buttons:Wrap with a
divwith a classpagination, so that you can better style it. Now for the styles, you can use a CSS something like this:Screenshot:
This would look this way:
Fiddle: http://jsfiddle.net/3Z9Jk/
To change in your code:
Please change these:
1.
2.