Home >Backend Development >XML/RSS Tutorial >RSS full site static output and RSS subscription steps (dedecms)
I read a lot of posts on the forum, but found that some people still don't know how to use it. Think the instructions are not detailed enough to make it possible! Let me tell you again. First, you create a new rss.php file and copy the following code into it:
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>http://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>http://www.jb51.net[field:arcurl/]</guid> <description><![CDATA[[field:description function='html2text(@me)'/] ... <b>文章分类</b>:[field:typename/]<a href="http://www.jb51.net[field:arcurl/]" target="_blank">阅读全文</a> | <a href="http://www.jb51.net/plus/recommend.php?aid=[field:id/]" target="_blank">邮件推荐</a> | <a href="http://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 homepage 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 must do as follows
-------------------------------------
Step one: Open the channel model Single-page document management
Click to add a page
Just follow the picture above to create such a single-page document, but the name cannot be "full-site RSS static output". It is better to use an English name. You can choose it by yourself. Click to save and ignore the others.
Finally update the cache. It is best to update the entire site.
For rss subscription, I put the original file in dede rssmap.html was redone and then overwritten with the original file. The original file is in the data folder.
Some popular RSS subscription codes are provided below for your reference.
<p class="indexContent"> <p><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></p> <p><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></p>
Dream Weaver Content Management System
<p><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></p> <p><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></p>
<p><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></p>
This article comes from Dreamweaver
<p><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></p> <p><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></p> </p>
The above is the detailed content of RSS full site static output and RSS subscription steps (dedecms). For more information, please follow other related articles on the PHP Chinese website!