鹰郡少年爱白妞妞 發表於 2023-9-17 00:00:00

dedecms添加rss订阅功能实现代码

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        装好dedecms后,点击左上角的rss功能,发现404错误,进入后台目录一看,发现rss文件就不存在,无奈,自己给dedecms添加rss订阅功能(代码来自网络,经检验正确!) <br>
        新建rss.php传到根目录: <br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode10" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        &lt;?php <br>
        require_once (dirname(__FILE__) . "/include/common.inc.php"); <br>
        require_once DEDEINC."/arc.partview.class.php"; <br>
        $pv = new PartView(); <br>
        $pv-&gt;SetTemplet($cfg_basedir . $cfg_templets_dir . "/default/rssmap.htm"); <br>
        header("Content-type:application/xml"); <br>
        $pv-&gt;Display(); <br>
        ?&gt; </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>新建rss.htm传至/templates/default目录下: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode11" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        &lt;?xml version="1.0" encoding="utf-8" ?&gt; <br>
        &lt;rss version="2.0"&gt; <br>
        &lt;channel&gt; <br>
        &lt;title&gt;{dede:global.cfg_webname/}&lt;/title&gt; <br>
        &lt;link&gt;{dede:global.cfg_basehost/}&lt;/link&gt; <br>
        &lt;description&gt;{dede:global.cfg_description/}&lt;/description&gt; <br>
        &lt;language&gt;zh-cn&lt;/language&gt; <br>
        &lt;generator&gt;{dede:global.cfg_webname/}&lt;/generator&gt; <br>
        &lt;webmaster&gt;{dede:global.cfg_adminemail/}&lt;/webmaster&gt; <br>
        {dede:arclist row='20' col='1' titlelen='100' orderby='pubdate'} <br>
        &lt;item&gt; <br>
        &lt;link&gt;http://www.jb51.net&lt;/link&gt; <br>
        &lt;title&gt;&lt;!]]&gt;&lt;/title&gt; <br>
        &lt;author&gt;&lt;/author&gt; <br>
        &lt;category&gt;&lt;/category&gt; <br>
        &lt;pubDate&gt;&lt;/pubDate&gt; <br>
        &lt;guid&gt;http://www.jb51.net&lt;/guid&gt; <br>
        &lt;description&gt;&lt;! ... ]]&gt;&lt;/description&gt; <br>
        &lt;/item&gt; <br>
        {/dede:arclist} <br>
        &lt;/channel&gt; <br>
        &lt;/rss&gt; </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>把域名改成你的域名,另外在后台-》模板管理-》head.htm里卖弄修改rss链接为:http://域名/rss.php</span></p>
頁: [1]
查看完整版本: dedecms添加rss订阅功能实现代码