织梦dedecms使用RSS订阅整站的实现代码
本文介绍下,dedecms织梦系统中,用rss实现全站订阅的实现方法与代码。有需要的朋友,参考下吧。 1,添加一个RSS模板,文件名为:rss_qq.htm,将RSS模板文件保存到/templets/plus/目录下
<span style="font-family: 'courier new', courier; font-size: 13px;"><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" 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 [email=href='%7B@me[%22arcurl%22]%7D']href='{@me["arcurl"]}'[/email] target='_blank'><img [email=src='%7B@me[%22litpic%22]%7D']src='{@me["litpic"]}'[/email] border='0' /><br />"); [/field:array][field:description function='html2text(@me)'/] ... ]]></description> </item> {/dede:arclist} </channel> </rss> </span> |
<span style="font-family: 'courier new', courier; font-size: 13px;"><?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_qq.htm"); header("Content-type:application/xml"); $pv->Display(); ?> </span> |
<span style="font-family: 'courier new', courier; font-size: 13px;"><link rel="alternate" type="application/rss+xml" title="{dede:field.title/}" href="http://www.genban.org/rss.php"/> </span> |
上一篇:招聘伪原创文章 修改dedecms默认文章标题长度的方法
下一篇:没有了