When I add a <li>
element (I want to have all the links in an <ul>
centered navigation) to this php pagination script, nothing shows up? But works fine when I use span:
echo "<span class='activestudent_pagination'>$i</span> ";
I'm new to PHP and was just wandering if someone could please help me out with what I'm doing wrong?
<div id="pages"><ul>
<?php
$show=6;
echo "<li><a href='?i=p&p=$page'>« PREV</a></li>";
if($page-($show/2) > 1){
$temp=$page-$show;
echo "<li><a href='?p=$temp'>...</a></li>";
}
if($page-($show/2) >= 1 && $page+($show/2) <= $pages){
$start=$page-($show/2);
$stop=$page+($show/2);
}
if($page-($show/2) < 1){
$start=1;
$stop=$show;
}
if($page+($show/2) > $pages){
$start=$pages-$show;
$stop=$pages;
}
for($i=$start; $i<=$stop; $i++){
if($page==$i){
echo "<li class='activespage'>$i</li>";
}
else{
echo "<li><a href='?p=$i'>$i</a></li>";
}
}
if($page+($show/2) < $pages){
$temp=$page+$show;
echo "<li><a href='?p=$temp'>...</a></li>";
}
echo "<li><a href='?i=n&p=$page'>NEXT »</li></a>";
?>
</ul>