$NUM){ if($page>=4){ $line[$con][0]= 1; $line[$con][1]= "<<"; $con++; } $ll = ($page-2); $rl = ($page+2); if ($gn<$rl){ $rl=$gn; if ($page<$gn){ $ll=$page-3; }else { $ll=$page-4; } } if ($ll <=0){ if ($gn>5){ $rl=5; }else { $rl=$gn; } $ll=1; } for($i=$ll;$i<=$rl;$i++){ if ($i == $page){ $line[$con][0]= $i; $line[$con][1]= "$i"; $con++; } else { $line[$con][0]= $i; $line[$con][1]= "$i"; $con++; } } if($page<($gn-2)){ $line[$con][0]= $gn; $line[$con][1]= ">>"; $con++; } $smarty->assign('line',$line); } $smarty->assign('news_',$news_); $smarty->assign('part_name',"Новости"); $smarty->assign('page_title',"Новости"); $smarty->assign('template_file',"index_news.tpl"); $smarty->display('index_main.tpl'); ?>