EXCMS RSS文件
来自站长百科
导航:返回上一页
代码[ ]
01 <? 02 03 /** 04 * Project: EXCMS: the PHP content management system. 05 * File: rss.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 zhanghaisong@sinoican.com 24 * @version $Rev: 146 $ 25 */ 26 27 /* $Id: rss.php 146 2009-11-10 07:58:36Z zhangxuelin $ */ 28 29 /** 30 * RSS 31 */ 32 33 //加载系统配置文件,移动本程序时,请修改配置文件路径 34 require_once ('configuration/inc/common.inc.php'); 35 36 //动态浏览(必须),否则无法使用分页功能 37 $_PAGE['dynamic'] = true; 38 39 //RSS ID 40 $channelid = $_GET['channelid'] ? $_GET['channelid'] : $_GET['rssid']; 41 $channelid = excms_func_id_decode($channelid); 42 43 if(is_numeric($channelid) && $channelid > 0){ 44 $_PAGE_CHANNEL = excms_func_getChannelCacheById($channelid); 45 46 //设置栏目地址 47 $_PAGE_CHANNEL['href'] = "http://" . $_SERVER['SERVER_NAME'] . $_PAGE_CHANNEL['href']; 48 49 //设置头部信息 50 header ('content-type: text/xml'); 51 header('Content-Disposition: inline; filename=rss_' . str_replace(' ', '', $_PAGE_CHANNEL['name']) . '.xml'); 52 echo '<?xml version="1.0" encoding="GBK" ?>'; 53 $tpl = 'rss.xml'; 54 55 }else{ 56 $_PAGE['title'] = 'RSS地图'; 57 excms_import("EXCMS.update.ChannelFunction"); 58 $_PAGE['position'] = ChannelFunction::getNavigation() . ' RSS地图'; 59 $tpl = 'rss.html'; 60 } 61 62 //输出模板 63 excms_func_templateDisplay($tpl); 64 65 ?>
代码说明[ ]
- $channelid = excms_func_id_decode($channelid); //解密栏目ID。
- $_PAGE_CHANNEL = excms_func_getChannelCacheById($channelid); //根据栏目ID获取栏目缓存
- $_PAGE['position'] = ChannelFunction::getNavigation() . ' RSS地图'; //获取当前导航栏。
代码修改[ ]
$_PAGE页面参数可以自由定义,根据模板的需要来增加和修改页面参数。模板中可调用页面的参数,例如:{$_PAGE.title}显示页面标题。$_PAGE_CHANNEL为栏目列表变 量数组,包含当前栏目的所有信息。
如果要更改RSS模板路径以及模板名称请修改$tpl变量值。