php page navigation by serial number
- by ilnur777
Can anyone help in this php page navigation script switch on counting normal serial number? In this script there is a var called "page_id" - I want this var to store the real page link by order like 0, 1, 2, 3, 4, 5 ...
$records = 34; // total records
$pagerecord = 10; // count records to display per page
if($records<=$pagerecord) return;
$imax = (int)($records/$pagerecord);
if ($records%$pagerecord>0)$imax=$imax+1;
if($activepage == ''){
$for_start=$imax;
$activepage = $imax-1;
}
$next = $activepage - 1; if ($next<0){$next=0;}
$prev = $activepage + 1; if ($prev>=$imax){$prev=$imax-1;}
$end = 0;
$start = $imax;
if($activepage >= 0){
$for_start = $activepage + $rad + 1;
if($for_start<$rad*2+1)$for_start = $rad*2+1; if($for_start>=$imax){ $for_start=$imax; }
}
if($activepage < $imax-1){
$str .= ' <a href="?domain='.$domain_name.'&page='.($start-1).'&page_id=xxx"><<< End</a> <a href="?domain='.$domain_name.'&page='.$prev.'&page_id=xxx">< Forward</a> ';
}
$meter = $rad*2+1;
for($i=$for_start-1; $i>-1; $i--){
$meter--;
$line = ''; if ($i>0)$line = "";
if($i<>$activepage){
$str .= "<a href='?domain=".$domain_name."&page=".$i."&page_id=xxx'>".($i)."</a> ".$line." ";
} else {
$str .= " <b class='current_page'>".($i)."</b> ".$line." ";
}
if($meter=='0'){ break; }
}
if($activepage > 0){
$str .= " <a href='?domain=".$domain_name."&page=".$next."&page_id=xxx'>Back ></a> <a href='?domain=".$domain_name."&page=".($end)."&page_id=xxx'>Start >>></a> ";
}
return $str;
Really need help with this stuff! Thanks in advance!