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.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
| 1. / 2. / ...
/mods/news/navlist.php
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('news');
$cs_get = cs_get('catid');
$cs_option = cs_sql_option(__FILE__,'news');
$data = array();
$tables = 'news ne INNER JOIN {pre}_categories cat ON ne.categories_id = cat.categories_id INNER JOIN {pre}_users us ON ne.users_id = us.users_id';
$select = 'ne.news_id AS news_id, ne.news_headline AS news_headline, ne.news_time AS news_time, ne.users_id AS users_id, us.users_nick AS users_nick';
$public = 'ne.news_public > \'0\' AND cat.categories_access <= \'' . $account['access_news'] . '\'';
if(!empty($cs_get['catid'])) {
$public .= ' AND cat.categories_id = ' . $cs_get['catid'];
}
$order = 'ne.news_time DESC';
$cs_news = cs_sql_select(__FILE__,$tables,$select,$public,$order,0,$cs_option['max_navlist']);
if(empty($cs_news)) {
echo $cs_lang['no_data'];
}
else {
if($cs_option['max_navlist'] == 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']);
$short = strlen($news['news_headline']) <= $cs_option['max_headline'] ? $news['news_headline'] : cs_substr($news['news_headline'],0,$cs_option['max_headline']) . '...';
$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']);
//
$data['news'][$run]['news_user'] = cs_link(cs_secure($news['users_nick']),'users','view','id=' . cs_secure($news['users_id']),0,0);
$com_news_id = $cs_news[$run]['news_id'];
$where_com = "comments_mod = 'news' AND comments_fid = '" . $com_news_id . "'";
$count_com = cs_sql_count(__FILE__,'comments',$where_com);
$data['news'][$run]['news_comcount'] = $count_com;
//
$run++;
}
echo cs_subtemplate(__FILE__,$data,'news','navlist');
}
themes/base/news/navlist.tpl
{loop:news}
{news:news_time} - {news:news_user} - {news:news_comcount} - <a href="{news:news_url}" title="{news:news_headline}">{news:news_short}</a>
<br />
{stop:news}
|