<?php

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_news`"), 0);
$kmess ='15';
echo '<div class="phdr"><center>Yangiliklar</center></div>';
echo '<div class="menu">';
$page = $page >= ceil($total / $kmess) ? ceil($total / $kmess) : $page;
$start = $page == 1 ? 0 : ($page - 1) * $kmess;
$nav = ($total > $kmess) ? '<div class="menu"><center>' . functions::display_pagination('/news/news.php?', $start, $total, $kmess) . '</center></div>' : '';
if ($total) {
$req = mysql_query("SELECT * FROM `cms_news` ORDER BY `time` DESC LIMIT ".$start.", ".$kmess);
$i = 1;
while (($tayota = mysql_fetch_assoc($req)) !== false) {
echo '<a href="'.$home.'/news/index.php?act=view&amp;id='.$tayota['id'].'"><img src="/ico/feed.png"> '.$tayota['name'].'</a><hr>';
++$i;
}
}
echo '</div>';
echo $nav;
?>