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