POST TIME:2021-05-21 23:11
織夢CMS默認情況下,RSS訂閱源是根據(jù)分類區(qū)分不同的RSS訂閱的。如果用戶想訂閱整個網(wǎng)站的RSS是個麻煩事。
解決辦法:
1,添加一個RSS模板,文件名為:rss_index.htm,將RSS模板文件保存到/templets/plus/目錄下。文件內(nèi)容為:
<?xml version="1.0" encoding="{dede:global.cfg_soft_lang /}" ?> |
2,在根目錄中添加rss.php文件,文件內(nèi)容為:
<?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.dnjsb.com/rss.php“/> |
然后重新生成靜態(tài),通過瀏覽器上的RSS源識別按鈕即可識別?;蛘咴诰W(wǎng)頁其它地方添加A標簽形式的訂閱鏈接。 默認情況下,最多調(diào)用50個最新的文章,它有個好處時,是動態(tài)文件,不需要每次生成,只要有新文章,RSS就會更新的。