I have a website that gives search results of products. I am using page numbering for splitting up search results from 1 to 10. I need to do some work on this search page. First of all, I want to fix the page numbering system. Currently it is showing a hyperlink for the page we are on. It should not do that. Because of this, users are not able to understand which page they are on. I need to do following things here:
1. Remove hyperlink for page number from the current page and replace it with a normal text (black)
2. If there are not more than 10 results, then it should not show any page number at the bottom.
I would really appreciate if you can help me find a bug and resolve this. Thanks!!
Below is the code I am using for php script:
<div id="lnk" style="text-align: center;">
<?php
$pages=intval($total/$limit);
if ($total%$limit) // has remainder so add one page
{
$pages++;
}
// next we need to do the links to other results
if ($startrow>=1) // bypass PREV link if startrow is 0
{
$prevs=($startrow-$limit);
//echo ' <a href="'.$_SERVER['PHP_SELF'].'?startrow='.($prevs).'&q='.($passinput).'" id="lnk">Prev »</a>';
}
$link=0;
for($i=1;$i<=$pages;$i++)
{
echo ' <a id="lnk" href="'.$_SERVER['PHP_SELF'].'?startrow='.($link).'&q='.($passinput).'" >'.$i.'</a>';
$link= $link+$limit;
}
// check to see if last page
if (!((($startrow+$limit)/$limit)==$pages) && $pages!=1)
{
// not last page so give NEXT link
$newr=$startrow+$limit;
//echo ' <a href="'.$_SERVER['PHP_SELF'].'?startrow='.($newr).'&q='.($passinput).'" id="lnk">»Next </a>';
}
$a = $startrow + ($limit);
$p=$a/10;
if ($a > $total)
{ $a = $total; }
$b = $startrow + 1;
?>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 18px; ">
<?php
//echo "<br>Showing results $p of $pages";
mysql_close($con);
?>
</span>
</div>
<br><br>
</div>
This is the code used for CSS:
/* Pagination */
#lnk a {
font-size: 15px;
text-decoration: none;
font-weight: bold;
color: blue;
border: 0px solid #0D62C3;
background-color: ;
padding: 3px;
-moz-border-radius: 3px;
}
#lnk a:hover {
font-size: 15px;
text-decoration: none;
font-weight: bold;
color: blue;
border: 0px solid #600e74;
background-color: ;
padding: 3px;
-moz-border-radius: 3px;
}
#lnk a:active {
font-size: 15px;
text-decoration: none;
font-weight: bold;
color: black;
border: 1px solid #600e74;
background-color: ;
padding: 3px;
-moz-border-radius: 3px;
}
#lnk a:visited {
font-size: 15px;
text-decoration: none;
font-weight: bold;
color: #600e74;
padding: 3px;
}