日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

[經(jīng)驗]dede全站RSS訂閱靜態(tài)輸出的辦法_DedeCms教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!
給大家分享一下實現(xiàn)DedeCMS Rss全站靜態(tài)輸出的方法,大家可以去嘗試一下。
一、在CMS根目錄下,新增rss.php文件,文件代碼如下:
  1. PHP代碼 
  2.      
  3. <?php     
  4. require_once (dirname(__FILE__) . "/include/common.inc.php");     
  5. require_once (DEDEINC."/arc.partview.class.php");     
  6. $pv = new PartView();     
  7. $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/default/rss.htm");     
  8. header("Content-type:application/xml");     
  9. $pv->Display();     
  10. ?>      
二、在默認(rèn)模板目錄(/templetes/default)中,新增rss.html模板文件,文件代碼如下:
  1. XML/HTML代碼    
  2. <?xml version="1.0" encoding="{dede:global.cfg_soft_lang /}" ?>       
  3. <rss version="2.0">       
  4. <channel>       
  5. <title>RSS訂閱-{dede:global.cfg_webname/}</title>       
  6. <link>{dede:global.cfg_basehost/}</link>       
  7. <description>{dede:global.cfg_description/}</description>       
  8. <language>zh-cn</language>       
  9. <generator>{dede:global.cfg_webname/}</generator>       
  10. <webmaster>{dede:global.cfg_adminemail/}</webmaster>       
  11. {dede:arclist row='100' col='1' titlelen='200' orderby='pubdate'}       
  12. <item>       
  13. <link>/[field:arcurl/]</link>       
  14. <title><![CDATA[[field:title function='html2text(@me)'/]]]></title>       
  15. <author>[field:writer/]</author>       
  16. <category>[field:typename/]</category>       
  17. <pubDate>[field:pubdate function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>       
  18. <guid>/[field:arcurl/]</guid>       
  19. <description><![CDATA[[field:description function='html2text(@me)'/]]]></description>        
  20. </item>       
  21. {/dede:arclist}     
  22. </channel>     
  23. </rss>   
三、在后臺——核心——頻道模型——單頁文檔管理,增加一個單頁面,“模板文件名”項中輸入第2步中涉及的模板文件rss.htm,而“文件名”中輸入未來Rss訂閱地址,這里我就直接生成在CMS根目錄下了。
 
四、更新一下緩存,并更新剛剛新增的單頁面,即可看到全站性的RSS輸出,以后很方便的就可以用各種RSS軟件去登錄Submit rss地址了。
 
因此,用單頁發(fā)布產(chǎn)品信息會很普遍,可惜的是上面談及的全站RSS靜態(tài)輸出的方法是無法提取單頁的,所以我們還需要對rss.html的模板代碼進行修改:
  1. XML/HTML代碼 
  2.      
  3. <?xml version="1.0" encoding="{dede:global.cfg_soft_lang /}" ?>       
  4. <rss version="2.0">       
  5. <channel>       
  6. <title>RSS訂閱-{dede:global.cfg_webname/}</title>       
  7. <link>{dede:global.cfg_basehost/}</link>       
  8. <description>{dede:global.cfg_description/}</description>       
  9. <language>zh-cn</language>       
  10. <generator>{dede:global.cfg_webname/}</generator>       
  11. <webmaster>{dede:global.cfg_adminemail/}</webmaster>       
  12. {dede:arclist row='100' col='1' titlelen='200' orderby='pubdate'}       
  13. <item>       
  14. <link>http://www.wlxs.com.cn[field:arcurl/]</link>       
  15. <title><![CDATA[[field:title function='html2text(@me)'/]]]></title>       
  16. <author>[field:writer/]</author>       
  17. <category>[field:typename/]</category>       
  18. <pubDate>[field:pubdate function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>       
  19. <guid>http://www.***.com[field:arcurl/]</guid>       
  20. <description><![CDATA[[field:description function='html2text(@me)'/]]]></description>        
  21. </item>       
  22. {/dede:arclist}     
  23. /********調(diào)用單頁的代碼********/     
  24. {dede:sql sql='Select * from dede_sgpage order by uptime asc limit 48'}       
  25. <item>       
  26. <link>http://www.***.com/[field:filename/]</link>       
  27. <title><![CDATA[[field:title function='html2text(@me)'/]]]></title>       
  28. <author></author>       
  29. <category></category>       
  30. <pubDate>[field:uptime function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>       
  31. <guid>http://www.***.com/[field:filename/]</guid>       
  32. <description><![CDATA[[field:body function='html2text(@me)'/]]]></description>       
  33. </item>       
  34. {/dede:sql}     
  35. /********調(diào)用單頁的代碼********/     
  36. </channel>       
  37. </rss>   
僅供大家學(xué)習(xí)使用,希望對你有所幫助!

查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

來源:模板無憂//所屬分類:DedeCms教程/更新時間:2020-04-16
相關(guān)DedeCms教程