织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

如何利用织梦dedeRSS订阅QQ邮件的方法

织梦园模板 / 2019-05-29 / 收藏

***近个人博客实现了织梦dedecms的RSS订阅功能,不过也发现了一些问题,尤其像是QQ订阅,我们只能使用一个栏目的源,如果栏目较多,我们就不知道怎么办了。QQlist是很多人在用的一个订阅的渠道,所以我们***要想个办法,让DEDE可以实现整站的订阅。

下面我推荐这个方法比较简单,不用改动DEDE的自身文件来实现,改动DEDE文件也会涉及到安全问题。

1,添加一个RSS模板,文件名为:rss_qq.htm,将RSS模板文件保存到/templets/plus/目录下

文件内容为:

<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" 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='50' orderby='pubdate' titlelen='200'}
<item>
<title><![CDATA[[field:title/]]]></title>
<link>[field:arcurl/]</link>
<category>[field:typename/]</category>
<pubdate>[field:pubdate function='strftime("%a,%d%b%Y%H:%M:%S +0800",@me)'/]</pubdate>
<description><![CDATA[[field:array runphp='yes']@me = (strpos(@me['litpic'],'defaultpic') ? "": "<a [email=href='%7B@me[%22arcurl%22]%7D']href='{@me["arcurl"]}'[/email] target='_blank'><img [email=src='%7B@me[%22litpic%22]%7D']src='{@me["litpic"]}'[/email] border='0' /><br />"); [/field:array][field:description function='html2text(@me)'/] ... ]]></description>
</item>
{/dede:arclist}
</channel>
</rss>

2.在根目录中添加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 . "/plus/rss_qq.htm");
header("Content-type:application/xml");
$pv->Display();
?>
3,在首页index.htm模板的头部标签中添加属性

代码如下:

<link rel="alternate" type="application/rss+xml" title="{dede:field.title/}" href="http://www.wwwww.com/rss.php"/>

 

按以上步骤操作之后,我们就可以实现DEDE的整站订阅了,我们可以访问你根目录的rss.php文件看到效果,在使用QQlist的时候,只需要把 rss.php的路径(就是“http://www.wwwww.com/rss.php")填进去,就可以实现整站的订阅了。通过浏览器上的RSS源识别按钮即可识别。

总结:默认情况下,***多调用50个***新的文章,不过它有个好处时,是动态文件,不需要每次生成,只要有新文章,RSS就会更新的。

相关织梦教程

收缩