<?php
defined('DCMS') or die;
global $user,$dcms;


$q = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1");

if (!mysql_num_rows($q))echo "<img src='/sys/vidgets/news/icon.png' alt='' /> <a href='/news/'>Наши новости</a>";
else
{
$news = mysql_fetch_assoc($q);

if ($news['time'] > mktime(-24)) // новость не старше суток будет отображаться на главной
{
echo "<img src='/sys/vidgets/news/icon.png' alt='' /> <a href='/news/'>".for_value($news['title'])."</a>";

$q2 = mysql_query("SELECT COUNT(*) FROM `news_comments` WHERE `id_news` = '$news[id]'");
$comments = mysql_result($q2,0);

if ($comments)
echo ' <span style="font-size:xx-small"><a href="/news/comments.php?id='.$news['id'].'">+'.$comments.'</a></span>';


echo '<br /><span style="font-size:xx-small">'.output_text($news['text']).'</span>';

}
else
{
echo "<img src='/sys/vidgets/news/icon.png' alt='' /> <a href='/news/'>".for_value($news['title'])."</a> ".vremja($news['time']);
}


}

?>
