首页 > CMS > 织梦DEDE > 正文

织梦模板小白讲堂二十九:织梦DEDECMS添加RSS订阅功能

2024-07-12 08:49:21
字体:
来源:转载
供稿:网友
这篇文章主要为大家详细介绍了织梦模板小白讲堂二十九:织梦DEDECMS添加RSS订阅功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。

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

最后我们再在后台 -> 模板管理 -> head.htm 里面修改rss链接为:http://域名/rss.php。

到这里我们就实现了织梦网站的RSS订阅的功能了。觉得有必要在自己网站增加这种RSS订阅的用户可以自己动手给自己的网站增加个RSS订阅吧。

以上就是织梦模板小白讲堂二十九:织梦DEDECMS添加RSS订阅功能的全部内容,希望对大家的学习和解决疑问有所帮助,也希望大家多多支持武林网。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表