服务器之家:专注于服务器技术及软件下载分享
分类导航

DEDECMS|帝国CMS|Discuz|PHPCMS|Wordpress|ZBLOG|ECSHOP|

服务器之家 - 建站程序 - DEDECMS - dedecms添加rss订阅功能实现代码

dedecms添加rss订阅功能实现代码

2019-09-08 11:53DEDECMS教程网 DEDECMS

给dedecms添加rss订阅功能可能是每一位使用者都所期望的功能,本文将给出解决方法,需要的朋友可以参考下

装好dedecms后,点击左上角的rss功能,发现404错误,进入后台目录一看,发现rss文件就不存在,无奈,自己给dedecms添加rss订阅功能(代码来自网络,经检验正确!) 
新建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/rssmap.htm"); 
header("Content-type:application/xml"); 
$pv->Display(); 
?> 


新建rss.htm传至/templates/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.zzvips.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.zzvips.com[field:arcurl/]</guid> 
<description><![CDATA[[field:description function='html2text(@me)'/] ... ]]></description> 
</item> 
{/dede:arclist} 
</channel> 
</rss> 


把域名改成你的域名,另外在后台-》模板管理-》head.htm里卖弄修改rss链接为:http://域名/rss.php

延伸 · 阅读

精彩推荐