hey guys,

i have some kind of cms and i wanna make a pagination on it

it's original pagination is

PHP Code:
<?php

$pages 
.="pages : ";

for(
$i=0;$i<$num_pages;$i++)
{
    
$s $i+1;
    if(
$s==$current) {
    
$pages .= "<FONT face=tahoma size=2><B>$s</B></FONT>&nbsp; &nbsp;";
    }else {
$pages .= "&nbsp;<A href='start-".$i*$limit1."'>[$s] </A>&nbsp;";
}
}
$p $_GET['start']+$limit1;
$pages .= "<A href='start-$p'>&nbsp;&gt;</A>";
                       
            
?>
and i have modified it to


PHP Code:
<?php

for($limit1=0;$limit1<$num_pages;$limit1++)
{
    
$s $limit1+2;
    if(
$s==$current) {
$p $_GET['start']-$pagesnum;
$pages .= "<td ><A href='p$p'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>prev</div></A></td>";  
    } 
    }

for(
$i=0;$i<$num_pages;$i++)

    
$s $i+1;
    if(
$s==$current) {
    
$pages .= "<td ><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='cpage'>$s</div></td>";
    }else {
$pages .= "<td ><A href='p".$i*$pagesnum."'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>$s </div></A></td>";
}

}

for(
$limit1=0;$limit1<$num_pages;$limit1++)
{
    
$s $limit1+1;
    if(
$limit1==$current) {
     
$p $_GET['start']+$pagesnum;
$pages .= "<td ><A href='p$p'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>next</div></A></td>";  
    } 
    }         
?>
but when the pages become more than 10



i need it when the pages become more then 10 to be like this




i hope you help me soon