织梦DedeCMS制作dedecms首页RSS订阅源


织梦DedeCMS的默认情况下,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:array runphp=’yes’]@me = (strpos(@me[‘litpic’],’defaultpic’) ? “”: “<a href='{@me[“arcurl”]}’ target=’_blank’><img src='{@me[“litpic”]}’ border=’0′ /><br />”); [/field:array][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、在首页index.htm模板的头部标签中添加属性,代码如下:

  <link rel=”alternate” type=”application/rss+xml” title=”{dede:field.title/}” href=”http://www.织梦58dede58.com/rss.php“/>

这样更改之后重新生成就可以了,在第三步中更改成自己的网址就可以了。