0){$st=$st-($previous*$listnos);$previous=0;} if($next>0){$st=$st+($next*$listnos);$next=0;} if($st<0){$st=0;} #conditions //$sql="from content where editdt >= (now() - interval 21 day) "; $sql="from content where 1 "; if(!empty($newscategory)){$sql.="and category='$newscategory' ";$pagetitle.=$categories[$newscategory];} if(!empty($newscountry)) { if(!empty($newscategory))$pagetitle.=" - "; $sql.="and country='$newscountry' "; $pagetitle.="Pravasi News From ".$countries[$newscountry]; } elseif(!empty($newscategory))$pagetitle.=" - Pravasi News"; if(isset($othernewslimit)) { $sql.="order by editdt desc "; $sql.="limit $othernewslimit"; $totcnt=$othernewslimit; } else { #get total count $entries=mysqli_query($db,"select count(*) as cnt ".$sql); $tmp=mysqli_fetch_object($entries); $totcnt=$tmp->cnt; if($totcnt>$maxnos)$totcnt=$maxnos; #actual query output $sql.="order by editdt desc "; $sql.=" limit ".$st.",".($listnos+1); } //echo "$totcnt - $sql"; $sql="select cid,header,blur,photothumb,textlink,dt,country,category,homelink,datediff(now(),dt) as daysold ".$sql; $getnews=mysqli_query($db,$sql); $cnt=mysqli_num_rows($getnews); include_once "header.php"; if($newscategory=="FIN" && !isset($othernewslimit)) include "special_finance.php"; //this might decreament $en value ?>
$listnos) { $cnt=$listnos; if(($st+$listnos+1)>$maxnos) $next=0; else $next=1; } if($st>0){$previous=1;} if($cnt>0) { $navigurl="newscountry=$newscountry&newscategory=$newscategory"; $navig="
"; #previous link if($previous==1) $navig.="<< ".mlconvert("XpSÀ¶pÅh").""."  :  "; #middle part - show page nos $pagelinksS=""; $pagelinksM=""; $pagelinksE=""; $pagelimit1=3; $pagelimit2=4; $pageradius=3; $pagelimit=$pagelimit1+$pagelimit2; $totpages=ceil($totcnt/$listnos); $thispage=($st/$listnos)+1; //club first extra pages if($thispage-$pageradius>1) { $pagelinksS.="1"; } if($thispage-$pageradius>2) { $tmp=round(1+($thispage-$pageradius)/2,0); $pagelinksS.="$tmp"; } /* $pagestart=$thispage-$pagelimit2; if($thispage-$pagelimit2>($pagelimit1-1)) { $interval=($pagestart-1)-1; $step=$interval/($pagelimit1-1); if($step>$pagelimit1)$gapcnt=$pagelimit1; else $gapcnt=round($step); } else { $interval=$pagelimit1; $step=1; $gapcnt=0; } $i=0; for($j=1;$j<=($pagestart-1);$j+=$step) { if(round($j)!=$i) { $i=round($j); $pagelinksS.="$i"; if($gapcnt-1>0 || $step<1)$gapcnt--; $pagelinksS.=str_repeat(".",$gapcnt); //$pagelinksS.="   "; } } } else $pagestart=1; */ //club last extra pages if($thispage+$pageradius<($totpages-1)) { $tmp=round(($totpages+($thispage+$pageradius))/2,0); $pagelinksE.="$tmp"; } if($thispage+$pageradius<$totpages) { $pagelinksE.="$totpages"; } /* if($thispage+$pagelimit2<$totpages) { $pageend=$thispage+$pagelimit2; if($thispage+$pagelimit2<$totpages-($pagelimit1-1)) { $interval=(($totpages-$pageend)); $step=$interval/($pagelimit1); $gapcnt=0; } else { $interval=($pagelimit1); $step=1; $gapcnt=-4; } $i=0; for($j=$pageend+$step;$j<=$totpages+.01;$j+=$step) { if(round($j)!=$i) { $i=round($j); if($gapcnt+10)$pagelinksE.=str_repeat(".",$gapcnt); elseif($gapcnt>-4 && $gapcnt<0) $pagelinksE.=str_repeat(".",$gapcnt*-1); $pagelinksE.="$i"; //$pagelinksE.="   "; } } } else $pageend=$totpages; */ #consecutive page nos if($thispage-$pageradius<1)$pagestart=1;else $pagestart=$thispage-$pageradius; if($thispage+$pageradius>$totpages)$pageend=$totpages; else $pageend=$thispage+$pageradius; for($i=$pagestart;$i<=$pageend;$i++) { if($i==$thispage){$pagelinksM.="$i";} else { if($i<$thispage) {$pagelinksM.="$i";} else {$pagelinksM.="$i";} } } $pagelinks=$pagelinksS.$pagelinksM.$pagelinksE; $navig.=$pagelinks; #next link if($next==1) $navig.="  :  "."".mlconvert("XpSÀ¶pÅh")." >>"; $navig.="
"; echo $navig; $st=0;$en=$cnt; include "shortnews.php"; echo $navig; } ?>
List all titles