<?php

    $lng_news = core::load_lng('news');
    $news_count = mysql_result(mysql_query("select count(*)  from `cms_news` where `time`<='" . time() . "' and `refid` = 1"), 0);
    echo '<a href="/news/"><div class="menu">» Yangiliklar (' .$news_count. ')</div></a>
    <div class="phdr">Manchester Yunayted</div>';

    $trans_req = mysql_query("select * from `cms_news` where `time`<='" . time() . "' and `refid` = 1  order by `time` desc limit $start, $kmess;");  
    while ($trans_res = mysql_fetch_array($trans_req)) {
        echo $i % 2 ? '
            <div class="smenu">' : '<div class="cmenu">';
                $comm = mysql_result(mysql_query("select count(*)  from `cms_news_comments` where `refid` = '".$trans_res['id']."'"), 0); 
                echo '
                <a style="color: #989386;text-shadow: 1px 1px 0px #fff;" href="/news/index.php?act=view&amp;id=' . $trans_res['id'] . '">
                    <img class="img_news" src="../files/news/news_' . $trans_res['id'] . '.png" /> 
                    <h5 class="news_h5">
                        ' . htmlentities($trans_res['name'], ENT_QUOTES, 'UTF-8') . ' 
                        <span class="news_time">
                            (' . date('d.m.Y / H:i:s', $trans_res['time'] + $sdvigclock * 3600) . ')
                        </span>
                    </h5> 
                    ' . htmlentities($trans_res['text'], ENT_QUOTES, 'UTF-8') . '
                    <br /> 
                    <span class="gray">
                        <small>
                           <span class="news_time">' .$lng['comments']. ': <a href="/news/index.php?act=comments&amp;id=' . $trans_res['id'] . '">' . $comm. '</a></span>
                        </small>
                    </span>
                </a>
            </div>
        ';
        ++$i;
    }
    if ($news_count > $kmess) {
        echo '<div class="topmenu">' . functions::display_pagination('index.php?', $start, $news_count, $kmess) . '</div>'; 
    }
    
?>
