Blame view

mobile/source/modules/admin/news_most_comments.php 1.11 KB
a1684257   Administrator   first commit
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
  <?php
  /**
  * @author:  Bunzia Alexander <nifus@mail.ru> <http://www.weblancer.net/users/nifus/>
  * @copyright: Copyright (c) 2010, Bunzia Alexander
  * @version: 1.0
  * @license: http://www.gnu.org/copyleft/gpl.html GNU/GPL
  * @package: ÏîÐåìîíòó.Ðó
  */
  
  function news_most_comments($options){
  	$t = new PHPTAL( false );
  	$t -> setSource(TMPL_NEWS_MOSTCOMMENTS_BLOCK);
  	include_once(MAIN_SOURCE_PATH.'/modules/news/inc/url.php');
  	include_once(MAIN_SOURCE_PATH.'/modules/news/inc/class.news.php');
  	$n = new news_q('n');
  	$n -> orderby_count_comments('DESC');
  	$n -> set_page(1);
  	$n -> set_count_rows(8);
  	$n -> where_active(1);
  	//$n -> set_debug(1);
  	$n -> get('n_title,n_alias as news_url',false);
  	$rows = array();
  	while( $row = $n -> row() ){
  		$rows[]=$row;
  	}
  	$t -> rows  = $rows;
  	$t -> URL_NEWS_MCOMMENTS_LISTING = URL_NEWS_MCOMMENTS_LISTING;
    return $t -> execute();
  }
  
  define('TMPL_NEWS_MOSTCOMMENTS_BLOCK','
  	<h3><a href="${URL_NEWS_MCOMMENTS_LISTING}">${B_NEWS_MCOMMENTS_LISTING}</a></h3>
  	<ul>
  	  <li tal:condition="rows" tal:repeat="r rows"><a target="_blank" href="${r/news_url}">${r/n_title}</a></li>
  	</ul>
  '
  );
  
  
  ?>