dedecms添加全站的rss订阅功能

今天就是分享下如何为dedecms添加RSS订阅:

  1、将下面的代码以rssmap.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/rssmap.htm");  
header("Content-type:application/xml");  
$pv->Display();   ?>


    2、将下面的内容存为rssmap.htm,传至模板根目录default下。
 
<?xml version="1.0" encoding="utf-8" ?>
 <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='20' col='1' titlelen='100' orderby='pubdate'}
                <item>
                <link>http://www.96seo.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.96seo.com[field:arcurl/]</guid>
                <description><![CDATA[[field:description function='html2text(@me)'/] ... ]]></description>
                </item>
                {/dede:arclist}
                </channel>
  </rss>


PS:注意将上面的www.96seo.com换为自己的网址。
更新下网站,你的网站RSS就是http://你的网站名字/rssmap.php。
再在模板的 header.php中修改一下rss的路径为 http://你的网站名字/rss.php  ,如http://www.96seo.com/rssmap.php 就是泰州seo的 订阅页面,欢迎朋友们添加。