EXCMS Digg文件
来自站长百科
导航:返回上一页
EXCMS的DIGG列表文件为:digg.php,可以按最新、本周、本月、本年、总排行显示最新内容列表。
代码[ ]
01 <?php 02 /** 03 * Project: EXCMS: the PHP content management system. 04 * File: digg.php 05 * * A product of SINOICAN Inc. 06 * 07 * EXCMS is a ten million data-level,high speed,human-based content management system. 08 * 09 * EX is Excellence & Express & Exceed & Expert. 10 * 11 * For questions, help, comments, discussion, please join the 12 * EXCMS mailing list. Send a blank e-mail to 13 * excms@sinoican.com 14 * or join the EXCMS forum 15 * www.excms.cn/forum 16 * 17 * @link http://www.excms.cn/ 18 * @copyright Copyright (c) 2007-2009 SINOICAN Inc. 19 * @license http://www.excms.cn/licenses/LICENSE-1.0 20 * @category EXCMS 21 * @author $Author: zhangxuelin $ 22 * @version $Rev: 15 $ 23 */ 24 25 /* $Id: digg.php 15 2009-10-27 09:31:46Z zhangxuelin $ */ 26 27 /** 28 * Digg列表 29 */ 30 31 //加载系统配置文件,移动本程序时,请修改配置文件路径 32 require_once ('configuration/inc/common.inc.php'); 33 excms_import("EXCMS.update.ChannelFunction"); 34 //列表类型 35 $type_array = array('day'=>'最近关注', 'week'=>'本周关注', 'month'=>'本月关注', 'year'=>'本年关注', 'all'=>'总排行'); 36 37 //获取当前类型 38 $_PAGE['type'] = $_GET['type']; 39 if(isset($_PAGE['type'])){ 40 if(!in_array($_PAGE['type'], array_keys($type_array))){ 41 echo "Unknow list type."; 42 } 43 }else{ 44 $_PAGE['type'] = 'day'; 45 } 46 47 //是否AJAX请求 48 $IS_AJAX_REQUEST = false; 49 50 //动态浏览(必须),否则无法使用分页功能 51 $_PAGE['dynamic'] = true; 52 53 //分页(必须) 54 $_PAGE['pageon'] = excms_func_page_decode($_GET['page']); 55 56 //获取栏目ID 57 $channelid = excms_func_id_decode($_GET['channelid']); 58 //当前栏目 59 if(is_numeric($channelid) && $channelid > 0){ 60 $_PAGE_CHANNEL = excms_func_getChannelCacheById($channelid); 61 }else{ 62 $_PAGE_CHANNEL['channelid'] = $channelid; 63 } 64 $_PAGE['crossid'] = excms_func_id_decode($_GET['crossid']); 65 if(is_numeric($_PAGE['crossid']) && $_PAGE['crossid'] > 0){ 66 $_PAGE_CHANNEL['crosschannel'] = excms_func_getChannelCacheById($_PAGE['crossid']); 67 $_PAGE_CHANNEL['href'] = ChannelFunction::listName($_PAGE_CHANNEL,1,$_PAGE_CHANNEL['crosschannel']['channelid']); 68 //页面字段 69 $_PAGE['title'] = $_PAGE_CHANNEL['crosschannel']['name'] . $type_array[$_PAGE['type']] . 'Digg'; 70 }else{ 71 $_PAGE_CHANNEL['crosschannel'] = null; 72 //页面字段 73 $_PAGE['title'] = $_PAGE_CHANNEL['name'] . $type_array[$_PAGE['type']] . 'Digg'; 74 } 75 76 //页面字段 77 $_PAGE['keywords'] = &$_PAGE_CHANNEL['keywords']; 78 $_PAGE['description'] = &$_PAGE_CHANNEL['description']; 79 80 //当前位置 81 $split_str = $_PAGE_CHANNEL['original_channelid'] > 0 ? ' ' . text2Html($EXCMS['list_symbol']).' ' : ''; 82 $_PAGE['position'] = ChannelFunction::getNavigation($_PAGE_CHANNEL['original_channelid'], $_PAGE['crossid']) . $split_str . 'Digg'; 83 84 //输出模板 85 excms_func_templateDisplay('digg.html'); 86 87 ?>
代码说明[ ]
- $channelid = excms_func_id_decode($channelid); //解密栏目ID(必须)。
- $crossid = excms_func_id_decode($_GET['crossid']); //解密交叉栏目(必须)。
- $_PAGE_CHANNEL = excms_func_getChannelCacheById($channelid); //根据栏目ID获取栏目缓存(必须)。
- $_PAGE_CHANNEL['href'] = ChannelFunction::listName($_PAGE_CHANNEL,1,$_PAGE_CHANNEL['crosschannel']['channelid']); //根据栏目以及交叉栏目获取当前栏
目的链接地址(必须)。
- $_PAGE['position'] = ChannelFunction::getNavigation($_PAGE_CHANNEL['original_channelid'], $_PAGE['crossid']) . $split_str . 'Digg'; //根据当前栏目
和交叉栏目获取当前导航栏(必须)。
页面字段数据放在$_PAGE变量数组,栏目的所有字段信息放在$_PAGE_CHANNEL变量数组。
- 页面参数
- $_PAGE['title'](排行标题)
- $_PAGE['keywords'] (排行关键字)
- $_PAGE['description'](排行描述)
- $_PAGE['position'](排行导航栏地址)
- $_PAGE['crossid'](交叉栏目)
- $_PAGE_CHANNEL包含当前栏目的所用信息,以上这些参数供模板里面标签使用。
代码修改[ ]
页面参数可以自由修改,根据模板的需要来增加和修改页面参数。模板中可自由调用页面的参数,例如:{$_PAGE.title}显示页面标题。