dedecmsHow to implement RSS full-site static output and RSS subscription?
First of all, you create a new rss.php file and copy the following code into it:
Recommended learning: Dream Weaver cms
The code is as follows:
<?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(); ?>
Save the file to the root directory of the site.
Then, make an rss.htm template output file and copy the following code into it:
The code is as follows:
<?xml version="1.0" encoding="gb2312" ?> <rss version="2.0"> <channel> <title>{dede:global.cfg_webname/}</title> <link>{dede:global.cfg_basehost/}</link> <description>{dede:global.cfg_description/}</description> copyright dedecms <language>zh-cn</language> <generator>{dede:global.cfg_webname/}</generator> <webmaster>{dede:global.cfg_adminemail/}</webmaster> {dede:arclist row='60' col='1' titlelen='100' orderby='pubdate'} <item> <link>https://www.jb51.net[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>https://www.jb51.net[field:arcurl/]</guid> <description><![CDATA[[field:description function='html2text(@me)'/] ... <b>文章分类</b>:[field:typename/] <a href="https://www.jb51.net[field:arcurl/]" target="_blank">阅读全文</a> | <a href="https://www.jb51.net/plus/recommend.php?aid=[field:id/]" target="_blank">邮件推荐</a> | <a href="https://www.jb51.net[field:arcurl/]" target="_blank">评论回复</a>]]></description> 织梦好,好织梦 </item> {/dede:arclist} </channel> </rss>
If you use it on your own site, Please replace the URL with your own. Save this file in the same directory as the index.htm home page template, log in to the management background, clear the cache, and update the html
---------------- --------------------------
The above is dynamic input. If you want to change it to static output, you need to press Do what is said below
----------------------------------------------
Step one: Open single-page document management under the channel model
Click to add a page
Just follow the picture above to create such a single-page file, but the name cannot be Use "site-wide RSS static output". It is best to use an English name. You can choose it by yourself. Click to save the others and ignore it.
Finally update the cache. It is best to update it in the whole site.
For rss subscription, I redid the original file rssmap.html in dede, and then overwritten the original file. The original file is in the data folder.
The following provides some popular rss subscription codes For your reference
<div class="indexContent"> <div><a href="http://www.google.com/reader/view/feed/http://www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_sub_google.gif" style="border:0px;" alt="通过Google订阅本站" /></a></div> <div><a href="http://www.zhuaxia.com/add_channel.php?url=www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/o_sub_zhuaxia.gif" style="border:0px;" alt="通过抓虾订阅本站" /></a></div> 织梦内容管理系统 <div><a href="http://www.xianguo.com/subscribe.php?url=www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_sub_xianguo.gif" style="border:0px;" alt="通过鲜果订阅本站" /></a></div> <div><a href="http://www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_sub_hexun.gif" style="border:0px;" alt="通过和讯博揽订阅本站" /></a></div> <div><a href="http://add.my.yahoo.com/rss?url=www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_sub_myyahoo.gif" style="border:0px;" alt="通过雅虎订阅本站" /></a></div> 本文来自织梦 <div><a href="http://reader.yodao.com/#url=http://www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_yodaoresbutton.gif" style="border:0px;" alt="通过有道订阅本站" /></a></div> <div><a href="http://www.bloglines.com/sub/http://www.shsui.cn/rss.xml" target="_blank" rel="nofollow"><img src="images/rss/o_sub_bloglines.gif" style="border:0px;" alt="通过BlogLines订阅本站" /></a></div> </div> 本文出自 “玩linux…做运维…没事..” 博客,请务必保留此出处
The above is the detailed content of How dedecms implements RSS full-site static output and RSS subscription. For more information, please follow other related articles on the PHP Chinese website!