织梦dedecms全站RSS输出详细教程
时间:2014-07-14
首先,你新建一个rss.php文件,把下面的代码拷贝到其中:
<?php
require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once DEDEINC."/arc.partview.class.php";
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/default/rss.htm");
header("Content-type:application/xml");
$pv->Display();
?>
保存该文件到站点根目录下。
然后,再制作一个rss.htm模板输出文件,把下面的代码拷贝到其中:
<?xml version="1.0" encoding="gb2312" ?>
<rss version="2.0">
<channel>
<title>{dede:global.cfg_webname/}</title>
<link>{dede:global.cfg_basehost/}</link>
<description>{dede:global.cfg_description/}</description>
<language>zh-cn</language>
<generator>{dede:global.cfg_webname/}</generator>
<webmaster>{dede:global.cfg_adminemail/}</webmaster>
{dede:arclist row='60' col='1' titlelen='100' orderby='pubdate'}
<item>
<link>http://www.5loveb.com[field:arcurl/]</link>
<title><![CDATA[[field:title function='html2text(@me)'/]]]></title>
<author>[field:writer/]</author>
<category>[field:typename/]</category>
<pubDate>[field:pubdate function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>
<guid>http://www.5loveb.com[field:arcurl/]</guid>
<description><![CDATA[[field:description function='html2text(@me)'/] ... <br /><b>文章分类</b>:[field:typename/]<br /><a href="http://www.5loveb.com[field:arcurl/]" target="_blank">阅读全文</a> | <a href="http://www.5loveb.com/plus/recommend.php?aid=[field:id/]" target="_blank">邮件推荐</a> | <a href="http://www.5loveb.com[field:arcurl/]" target="_blank">评论回复</a>]]></description>