1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
| 1. / 2. / ...
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('news');
$cs_option = cs_sql_option(__FILE__,'news');
$data = array();
$select = 'ne.news_id AS news_id, ne.news_headline AS news_headline, ne.news_time AS news_time';
$public = 'ne.news_public > \'0\' AND cat.categories_access <= \'' . $account['access_news'] . '\'';
###########################
$order = 'ne.comments_count DESC';
###########################
$tables = 'news ne INNER JOIN {pre}_categories cat ON ne.categories_id = cat.categories_id';
$cs_news = cs_sql_select(__FILE__,$tables,$select,$public,'ne.comments_count DESC',0,$cs_option['max_navtop']);
if(empty($cs_news)) {
echo $cs_lang['no_data'];
}
else {
if($cs_option['max_navtop'] == 1)
$cs_news = array(0 => $cs_news);
$run = 0;
foreach ($cs_news AS $news) {
$data['news'][$run]['news_time'] = cs_date('unix',$news['news_time'],1,1);
$short = strlen($news['news_headline']) <= 36 ? $news['news_headline'] : substr($news['news_headline'],0,$cs_option['headline_short']) . '...';
$data['news'][$run]['news_url'] = cs_url('news','view','id=' . $news['news_id']);
$data['news'][$run]['news_short'] = cs_secure($short);
$data['news'][$run]['news_headline'] = cs_secure($news['news_headline']);
###########################
$where3 = "comments_mod = 'news' AND comments_fid = " . $news['news_id'];
$data['news'][$run]['comments_count'] = cs_sql_count(__FILE__, 'comments', $where3);
###########################
$run++;
}
echo cs_subtemplate(__FILE__,$data,'news','navtop');
} |