@Content[] $result[1] @my_body[] ^connect[$connect_string]{ ^if(def $form:ID){ $News[^table::sql{SELECT ID, Date, Head, Anons, News, Type FROM News WHERE Moderated = 1 and ID = $form:ID }] $allpages(0) }{ ^if(def $form:p){$page($form:p)}{$page(1)} $beg(($page-1)*15) $limit[LIMIT $beg,15] ^if(def $form:Type){ $News[^table::sql{SELECT ID, Date, Head, Anons, News, Type FROM News WHERE Moderated = 1 and Type = $form:Type ORDER BY `Date` DESC $limit}] $NewsAll[^table::sql{SELECT COUNT(*) AS A FROM News WHERE Type = $form:Type}] }{ $News[^table::sql{SELECT ID, Date, Head, Anons, News, Type FROM News WHERE Moderated = 1 ORDER BY `Date` DESC $limit}] $NewsAll[^table::sql{SELECT COUNT(*) AS A FROM News}] } ^if($NewsAll.A>0){$allpages(^eval($NewsAll.A/15)[%d]+1)} ^if(^News.count[]<15){$next(0)}{$next($page+1)} ^if($page>1){$prev($page-1)}{$prev(0)} } } ^page_nav[$prev;$next;$allpages;$page] ^News.menu{ $News.Head
^untaint[as-is]{$News.News}
} ^page_nav[$prev;$next;$allpages;$page] @page_nav[prev;next;allpages;page]

^if($allpages>1){ ^if($prev>0){ [Первая -1] } [Страница $page из $allpages] ^if($next>0){ [+1 Последняя] } }