Файл: news/index.php
Строк: 42
<?
include_once '../system/sys.php';
include '../system/funcs.php';
if(!$cms->us['id']){
header('location: /');
exit;
}
verh('Новости','Новости проекта ('.$func->getCount('id','news').')');
if($func->getCount('id','news')==0){
echo '<div class="list1">Новостей нет!</div>';
}else{
$num = 10;
$posts = $func->getCount('id','news');
$total = intval(($posts - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$news = DB::$dbs->query("SELECT * FROM `news` order by `id` desc limit $start,$num");
while($n = $news -> fetch()){
echo'<div class="list1">'.$func->text($n['text']).'<br><span style="color: #6d6d6d;">Добавил: '.$func->uNick($n['us']).' ('.t($n['t']).')</span><br><a href="/komm'.$n['id'].'">Комментарии</a> ('.DB::$dbs->querySingle("SELECT count(id) from `news_komm` where `id_news` = ?",array($n['id'])).')</div>';
}
echo '<div class="lst">';
$func->page('/news');
echo '</div>';
}
niz();
?>