默认情况下, 织梦 CMS 的 RSS 订阅源是根据分类订阅不同栏目的 RSS. 如果想订阅整站的 RSS 就有点困难.
解决办法:
1, 添加一个 RSS 模板, 新建名为: rss_index.htm 整站 RSS 模板文件并保存到 / templets/plus / 目录下.
文件内容为:
- <?xml version="1.0" encoding="{dede:global.cfg_soft_lang /}" ?>
- <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='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: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_index.htm");
- header("Content-type:application/xml");
- $pv->Display();
- ?>
3, 在织梦 CMS 模板文件 head.htm 的头部标签 < head> 中添加 link 属性.
代码如下:
<link rel="alternate" type="application/rss+xml" title="网投之家" href="http://www.bbinhome.com/rss.php https://www.bbinhome.com/rss.xml" />
来源: http://www.bubuko.com/infodetail-2960652.html