EXCMS 列表文件
来自站长百科
导航:返回上一页
EXCMS的列表页文件为:list.php,用于显示某栏目头条、焦点、推荐、滚动、图片内容列表。
代码[ ]
01 <? 02 03 /** 04 * Project: EXCMS: the PHP content management system. 05 * File: list.php 06 * 07 * A product of SINOICAN Inc. 08 * 09 * EXCMS is a ten million data-level,high speed,human-based content management system. 10 * 11 * EX is Excellence & Express & Exceed & Expert. 12 * 13 * For questions, help, comments, discussion, please join the 14 * EXCMS mailing list. Send a blank e-mail to 15 * excms@sinoican.com 16 * or join the EXCMS forum 17 * www.excms.cn/forum 18 * 19 * @link http://www.excms.cn/ 20 * @copyright Copyright (c) 2007-2009 SINOICAN Inc. 21 * @license http://www.excms.cn/licenses/LICENSE-1.0 22 * @category EXCMS 23 * @author $Author: zhangxuelin $ 24 * @version $Rev: 146 $ 25 */ 26 27 /* $Id: list.php 146 2009-11-10 07:58:36Z zhangxuelin $ */ 28 29 /** 30 * 内容列表 31 * 32 * 类型:最新,焦点,头条,推荐,滚动,图片 33 */ 34 35 //加载系统配置文件 36 require_once ('configuration/inc/common.inc.php'); 37 38 //加载栏目更新方法成员类 39 excms_import("EXCMS.update.ChannelFunction"); 40 41 //列表类型 42 $type_array = array('newest'=>'最新', 'head'=>'头条', 'focus'=>'焦点', 'recommend'=>'推荐', 'scroll'=>'滚动', 'image'=>'图片'); 43 44 //获取当前类型 45 $_PAGE['type'] = trim($_GET['type']); 46 if(isset($_PAGE['type'])){ 47 if(!in_array($_PAGE['type'], array_keys($type_array))){ 48 echo "Unknow list type."; 49 exit(); 50 } 51 }else{ 52 $_PAGE['type'] = 'newest'; 53 } 54 55 //分页(必须) 56 $_PAGE['pageon'] = excms_func_page_decode($_GET['page']); 57 58 //动态浏览(必须) 59 $_PAGE['dynamic'] = true; 60 61 //栏目ID 62 $channelid = $_GET['channelid'] ? $_GET['channelid'] : $_GET['id']; 63 $channelid = excms_func_id_decode($channelid); 64 $crossid = excms_func_id_decode($_GET['crossid']); 65 66 //当前栏目 67 if(is_numeric($channelid) && $channelid > 0){ 68 $_PAGE_CHANNEL = excms_func_getChannelCacheById($channelid); 69 }else{ 70 $_PAGE_CHANNEL['channelid'] = $channelid; 71 } 72 $_PAGE['crossid'] = excms_func_id_decode(&$crossid); 73 if(is_numeric($_PAGE['crossid']) && $_PAGE['crossid'] > 0){ 74 $_PAGE_CHANNEL['crosschannel'] = excms_func_getChannelCacheById($_PAGE['crossid']); 75 $_PAGE_CHANNEL['href'] = ChannelFunction::listName($_PAGE_CHANNEL,1,$_PAGE_CHANNEL['crosschannel']['channelid']); 76 //页面字段 77 $_PAGE['title'] = $_PAGE_CHANNEL['crosschannel']['name'] . $type_array[$_PAGE['type']] . '内容'; 78 }else{ 79 $_PAGE_CHANNEL['crosschannel'] = null; 80 //页面字段 81 $_PAGE['title'] = $_PAGE_CHANNEL['name'] . $type_array[$_PAGE['type']] . '内容'; 82 } 83 84 //页面字段 85 $_PAGE['keywords'] = &$_PAGE_CHANNEL['keywords']; 86 $_PAGE['description'] = &$_PAGE_CHANNEL['description']; 87 88 //当前位置 89 $split_str = $_PAGE_CHANNEL['original_channelid'] > 0 ? ' ' . text2Html($EXCMS['list_symbol']).' ' : ''; 90 $_PAGE['position'] = ChannelFunction::getNavigation($_PAGE_CHANNEL['original_channelid'], $_PAGE['crossid']) . $split_str . $type_array[$_PAGE['type']]; 91 92 //Display 93 excms_func_templateDisplay('list_type.html'); 94 95 ?>
代码说明[ ]
- $type_array = array('newest'=>'最新', 'head'=>'头条', 'focus'=>'焦点', 'recommend'=>'推荐', 'scroll'=>'滚动', 'image'=>'图片'); // 定义列表类型
- $_PAGE['pageon'] = excms_func_page_decode($_GET['page']); //获取分页并解密分页字符串
- $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 . *$type_array[$_PAGE['type']]; //根据当前栏目和交叉栏目获取当前导航栏。
页面字段数据放在$_PAGE变量数组,栏目的所有字段信息放在$_PAGE_CHANNEL变量数组。
- 页面参数
- $_PAGE['title'](列表标题)
- $_PAGE['keywords'](列表关键字)
- $_PAGE['description'](列表描述)
- $_PAGE['position'](列表导航栏地址)
- $_PAGE['dynamic'](是否动态浏览)
- $_PAGE['pageon'](列表当前页)
- $_PAGE['type'](列表类型)
- $_PAGE['crossid'] (交叉栏目)
- $_PAGE_CHANNEL包含当前栏目的所用信息,以上这些参数供模板里面标签使用。
代码修改[ ]
页面参数可以自由修改,根据模板的需要来增加和修改页面参数。模板中可自由调用页面的参数,例如:{$_PAGE.title}显示页面标题。