Размер файла: 1.57Kb
<?php
define('_WBLIB',1);
require_once ('inc/core.php');
// Заголовки
$title = 'Новые статьи';
require_once ('inc/head.php');
#############################
echo '<div class="title">Новые статьи</div>';
$old = $time - (1 * 24 * 3600);
$posts = mysql_result(mysql_query('SELECT COUNT(*) FROM `article` WHERE `type` = "2" AND `time` > '.$old.''),0);
$total = intval(($posts - 1) / $num) + 1;
if($page > $total) $page = $total;
$start = $page * $num - $num ;
$result = mysql_query('SELECT * FROM `article` WHERE `type` = "2" AND `time` > '.$old.' LIMIT '.$start.', '.$num.'');
if ($posts >0) {
while ($m = mysql_fetch_array($result)) {
$cat = mysql_fetch_array(mysql_query("SELECT `name`,`id` FROM `article` WHERE `id` = '".$m['id_cat']."'"));
echo '<div class="link">';
echo '<img src="images/article.png" alt="article"/> <a href="article.php?id='.$m['id'].'">'.$m['name'].'</a> ['.date('d.m.Y|H:i',$m['time']).']<font color="red">NEW!</font><br/>';
echo '<small>Категория: <a href="view.php?id='.$cat['id'].'">'.$cat['name'].'</a></small>';
if ($set['prew']) echo '<br/>'.preview_desc($m['text']);
echo '</div>';
}
}
else {
echo '<div class="link">Новых статей нет</div>';
}
// Вывод меню
if ($posts > $num) {
nav($total,$page,$num,'new.php?');
}
echo '<div class="bar">Всего новых файлов '.$posts.'</div>';
echo '<div class="title"><a href="'.$home.'">Главная</a></div>';
require_once ('inc/foot.php');
?>