織夢站點內(nèi)容怎么自動更新到新浪微博?
織夢DEDEcms站點內(nèi)容自動更新到新浪微博
推薦學習:織夢cms
新浪微博是利用feed找到更新文章的。只要給他指定feed地址就可以成功關(guān)聯(lián)啦。
現(xiàn)在開始動手簡單修改一下織夢的模板,由于織夢不能生成全站的xml文件,所以要先建立生成全站XML的php程序。
1,建立feed.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?.?"/feed.htm");??? header("Content-type:application/xml");??? $pv->Display();??? ?>
以上要注意的是修改模板的路徑,確保在模板跟目錄能夠找到feed.htm
2,建立feed.htm模板文件
<?xml version="1.0" encoding="gb2312" ?>??? <rss>??? <channel>??? <title>{dede:global.cfg_webname/}</title>??? <link>{dede:global.cfg_basehost/}??? <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=’60′?col=’1′?titlelen=’100′?orderby=’pubdate’}??? <item>??? <link>[field:arcurl/]??? <title></title>??? <author>[field:writer/]</author>??? <category>[field:typename/]</category>??? <pubdate>[field:pubdate?function='strftime("%a,?%d?%b?%Y?%H:%M:%S?+0800",@me)'/]</pubdate>??? <guid>[field:arcurl/]</guid>??? <description></description>??? </item>??? {/dede:arclist}??? </channel>??? </rss>
需要注意的是,別忘了把我的網(wǎng)址改成你自己需要的。
3,修改index.htm主頁模板
由于新浪微博只能驗證網(wǎng)址,不能寫完整路徑,比如我寫的是:。結(jié)果提示關(guān)聯(lián)失敗,解決的辦法是,在
和中間加入下面的代碼
<link>
通過以上方法就可以成功關(guān)聯(lián)新浪微博了。
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END