最模板 - 外贸网站建设,外贸网站模板

最模板

当前位置: 首页 > 建站教程 > CMS教程 > DedeCMS教程 >

dedecms织梦怎么添加RSS订阅功能

时间:2014-12-24 23:57来源: 作者: 点击:
订阅好像是现在很流行的字眼,很多人都会在网站上添加RSS订阅,如果你也想要在网站上添加一个RSS订阅功能的话,也可以来试试这种方法。

订阅好像是现在很流行的字眼,很多人都会在网站上添加RSS订阅,如果你也想要在网站上添加一个RSS订阅功能的话,也可以来试试这种方法。
新建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 . "/default/rssmap.htm");
header("Content-type:application/xml");
$pv->Display();
?>
新建rss.htm传至/templates/default目录下:
<?xml version="1.0" encoding="utf-8" ?>
<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='20' col='1' titlelen='100' orderby='pubdate'}
<item>
<link>http://www.vcphp.com[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.vcphp.com[field:arcurl/]</guid>
<description><![CDATA[[field:description function='html2text(@me)'/] ... ]]></description>
</item>
{/dede:arclist}
</channel>
</rss>
在上传的时候把里面的www.vcphp.com换成你自己的域名,然后在后天的模板管理中找自己网站模板中的RSS链接换成http://你的域名/rss.php的形式,然后生成一次就可以看到效果了。

(责任编辑:最模板)
------分隔线----------------------------
栏目列表
推荐内容