Hi everyone, Just playing with abit of php code and could do with a spot of help.
The following bit of PHP code is taken from a php script i'm running, The code shows Previous and next and all page numbers between for search results on my website.
What i want is only to show Previous >(then 3 pages) 4 5 6 < Next
At the moment i'm getting previous > then 80+ pages between < next which is filling the page up.
$prevnext="";
if ($numar>10)
{
if ($numar%10!=0) $numarp=($numar/10)+1;
else $numarp=($numar/10);
if ($page>1) $prevnext.=' [<a href="member.php?action=emaillist&searchemail='.htmlentities(urlencode($searchemail)).'&page='.($page-1).'" >'.'<< Previous'.'</a>]';
else $prevnext.=' [<< Previous]';
for($i=1; $i<=$numarp; $i++)
{
if ($page==$i) $classxx='class="navlink"'; else $classxx='';
$prevnext.=' [<a '.$classxx.' href="member.php?action=emaillist&searchemail='.htmlentities(urlencode($searchemail)).'&page='.$i.'">'.$i.'</a>]';
}
if ($page<$numarp-1) $prevnext.=' [<a href="member.php?action=emaillist&searchemail='.htmlentities(urlencode($searchemail)).'&page='.($page+1).'" >'.'Next >>'.'</a>]';
else $prevnext.=' [Next >>]';
}
$memberemaillisttemplate=str_replace("{prevnext}",$prevnext,$memberemaillisttemplate);
$memberemaillisttemplate=str_replace("{emaillist}",$emaillist,$memberemaillisttemplate);
$content=str_replace("{tblcontent}",$memberemaillisttemplate,$content);
}
Any help much appreciated.
Thanks
Chris.