Home > CMS Tutorial > DEDECMS > How dedecms implements RSS full-site static output and RSS subscription

How dedecms implements RSS full-site static output and RSS subscription

藏色散人
Release: 2019-12-25 09:46:07
Original
2026 people have browsed it

How dedecms implements RSS full-site static output and RSS subscription

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(); 
?>
Copy after login

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=&#39;60&#39; col=&#39;1&#39; titlelen=&#39;100&#39; orderby=&#39;pubdate&#39;} 
<item> 
<link>https://www.jb51.net[field:arcurl/]</link> 
<title><![CDATA[[field:title function=&#39;html2text(@me)&#39;/]]]></title> 
<author>[field:writer/]</author> 
<category>[field:typename/]</category> 
<pubDate>[field:pubdate function=&#39;strftime("%a, %d %b %Y %H:%M:%S +0800",@me)&#39;/]</pubDate> 
<guid>https://www.jb51.net[field:arcurl/]</guid> 
<description><![CDATA[[field:description function=&#39;html2text(@me)&#39;/] ... 
<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>
Copy after login

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…做运维…没事..” 博客,请务必保留此出处
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template