class.top_down.php
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
<?php /** * @package Zeed * @copyright Copyright (c) 2006 Zeed.ST . (http://www.zeed.com.cn) * @author xsharp * @since 2006-9-4 上午10:11:24 * @version $Id$ */ // 包含 Taglib 基类. include_once(dirname(__FILE__)."/taglib.php"); /** * 该标签用于输出下载排行 * * 使用方法: * $tag = new tag_top_down(); * $tag->output(); * * @param array $input; */ class tag_top_down extends taglib { // 分类ID var $cid; // 需要显示的条数 var $num; // 标题显示的长度 var $len; // 排序KEY var $order; // 升序or降序 var $sort; function main(){ /** * 定义要使用的SKIN文件. * 因为表现形式上和"List"标签差不多,所以我们这里使用了"List"标签的SKIN文件,即下面的:'list_' */ $this->template_use = 'list_'.(($this->tag_setting['skin'])?$this->tag_setting['skin']:'1'); // 条数 $this->num = $this->tag_setting[num]; if($this->num == 0 or $this->num > 100){ $this->num = 10; } $this->order = ($this->tag_setting['order'] != '')?$this->tag_setting['order']:'hits_total'; $this->sort = ($this->tag_setting['sort'] == 'asc')?'ASC':'DESC'; $rows = $this->getTopDao(); $this->getTopView($rows); } function top(){ } /* * 对结果处理 */ function getTopView($rows){ if(!is_array($rows) or count($rows) < 1){ echo $this->template->quick_get_from_handle('error'); } foreach ($rows as $val){ $i++; // 行号支持 $val[no] = $i; if($val[c_id] == 0){ $val[c_id] = $this->guids_c_id["".$val[guid].""]; } // 多列支持 $cols=($this->tag_setting[cols])?$this->tag_setting[cols]:1; if(($i%$cols)==0){ $val['TR'] = ' </tr><tr> '; $val['BR'] = ' <BR /> '; } // 获取分类URL地址 $c_url = ($this->c_rows["".$val[c_id].""]['c_url'])?$this->c_rows["".$val[c_id].""]['c_url'] :$this->inews_path->htdocs_url.$this->c_rows["".$data_arr[c_id].""]['path']; // 构建文件名 $file_name = build_file_name($val); // 构建自定义目录名 $file_folder = file_page::build_dir($this->c_rows["".$val[c_id].""],$val[datetime]); // 生成链接地址 $val['link'] = (strlen($val[refresh_url])>7)?$val[refresh_url] :$c_url.'/'.$file_folder.'/'.$file_name.'.'.$this->inews_conf['file_ext']; // 日期格式 $date_format = ($this->tag_setting[date_format])?$this->tag_setting[date_format]:$this->inews_conf['date_list']; $val['date'] = date($date_format,$val['datetime']); // 当日新闻彩色显示 if($this->inews_conf[title_new_is_color] and (date('Y-m-d',$val['datetime']) == date('Y-m-d'))){ $val[style] = 'new_color'; }else{ $val[style] = 'new_normal'; } $val['c_url'] = $c_url; $val['c_title'] = $this->c_rows["".$val[c_id].""]['c_title']; $val['c_path'] = $this->c_rows["".$val[c_id].""]['path']; // 自定义图片宽x高 $val['image_width'] = ($this->tag_setting['img_width'])?" width=\"".$this->tag_setting['img_width']."\" ":' '; $val['image_height'] = ($this->tag_setting['img_height'])?" height=\"".$this->tag_setting['img_height']."\" ":' '; // 自定义首页标题 $len = ($this->tag_setting[len])?$this->tag_setting[len]:36; if(trim($val[title4index]) == ''){ if($len > 0 && $len < strlen($val[title])){ $val[title4index] = csubstr($val[title],$len); }else{ $val[title4index] = $val[title]; } }else{ if($len > 0 && $len < strlen($val[title4index])){ $val[title4index] = csubstr($val[title4index],$len); } } // 处理以中文书名号(《)开头的行 if(substr($val[title4index],0,2) != '《' and !isset($this->tag_setting[no_space])){ $val[title4index] = ' '.$val[title4index]; } // 自定义简介长度 if($summary_len > 0){ $val[summary] = csubstr($val[summary],$summary_len); } // 自定义标题颜色 if(strlen($val[color]) > 3){ $val[title4index] = "<font color=\"#".$val[color]."\">".$val[title4index]."</font>"; } $val[title] = htmlspecialchars($val[title]); $this->template->assign_block_vars('list',$val); } echo $this->template->quick_get_from_handle($this->template_use); } /* * 使用JOIN方式获取下载排行 * 如果数据量比较大时,建议分步来检索,比如先查 inews_down_hits 表,再查 inews_down_cate_link ... */ function getTopDao(){ $where = "WHERE l.status_id = 1"; if($this->tag_setting[cid] > 0){ $where .= " AND l.c_id=".$this->tag_setting[cid]; } $order_sort = "ORDER BY ".$this->order." ".$this->sort; $sql = "SELECT h.hits_total,h.hits_year,h.hits_month,h.hits_week,h.hits_today,l.c_id,l.is_recommend,l.is_headline,d.* FROM ".$this->dt->down_hits." h LEFT JOIN ".$this->dt->down_cate_link." l ON(h.guid = l.guid) LEFT JOIN ".$this->dt->down." d ON(h.guid = d.guid) ".$where." ".$order_sort." "; $rs = $this->db->SelectLimit($sql,$this->num); // print_m($sql); return $rs->GetRows(); } } ?>
tag.top_down.php
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
<?php /** * @package Zeed * @copyright Copyright (c) 2006 Zeed.ST . (http://www.zeed.com.cn) * @author xsharp * @since 2006-9-4 下午09:20:57 * @version $Id$ */ include('tag_pre.php'); // 检测缓冲文件 if(!database::cache_data_check($cache_file,$timeout)){ $tag = new tag_top_down(); $tag->write($cache_file,$tag->output); $tag->output(); }else{ readfile($cache_file); } ?>