Файл: bloodlands.pw/news/count.php
Строк: 48
<?
// счетчик новостей
$_news = mysql_fetch_assoc(mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1"));
$ressau = mysql_query("SELECT `news`.*,(SELECT COUNT(id) FROM `newscomm` WHERE `newscomm`.`id_new`=`news`.`id`) AS c FROM `news` ORDER BY `news`.`id` DESC LIMIT 1");
$_new_news = mysql_result(mysql_query("SELECT COUNT(id) FROM `news` WHERE `date` > '" . (time() - 86400) . "'"), 0);
$new_news = (!empty($_new_news)) ? ' <span style="color: #FF0000;">+' . $_new_news . '</span>' : '';
$_date = ($_news != '') ? '(' . date('d.m.y', $_news['date']) . ')' . $new_news : '';
while($sqll = mysql_fetch_assoc($ressau))
{
$cont = (mb_strlen($_news['content'], 'UTF8') > 100)
? mb_substr($_news['content'], 0, 100, 'UTF8') . '...'
: $_news['content'];
if (isset($cont))
{
$lastNew = '<div class="widget"><b>' . bb_code($_news['name']) . '</b> ' . $_date . '<br/>
' . bb_code($cont) . '</div>';
}
echo '<div class="title">Новости</div>
<div class="menu">' . $lastNew . '';
echo '<div class="auth2"><a href="/news/?do=view&i='.$_news['id'].'">Читать всю</a> Комментарии (' . $sqll['c'] . ')</div></div>';
echo '<div class="menu"><a class="ssyl2" href="/news/"> <img src="views/default/img/news.png" alt=""/> Все новости</a></div>';
//echo '<div class="menu"><a class="ssyl2" href="/guest/"> <img src="views/default/img/g.gif" alt=""/> Гостевая книга</a></div>';
}
?>