POST TIME:2019-03-19 16:28
dedecms中讓新浪微薄的訪問量到站上來,讓站上的流量到微博上去,都可以的哦,大家都知道dedecms本身沒有生成全站xml的,可是讓sina微博自動關(guān)聯(lián)站上的文章就不會成功,分兩步來實現(xiàn)這個功能,
1.讓dedecms全站輸出xml,2.在sina微博上關(guān)聯(lián)上站點,弄好后站上每發(fā)表了文章sina微博就自動發(fā)表一篇關(guān)于文章的微博。
1.讓dedecms全站輸出xml。
①,建立php全站輸出文件,新建一個記事本把以下代碼貼上然后保存,重命名這個文件為 rss.php 重命名后確保是個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 . “/default/rss.htm”); header(“Content-type:application/xml”); $pv->Display(); ?>
②,建立再新建一個記事本把一下代碼貼上,保存,重命名為rss.htm,記住把你的網(wǎng)址填上。
<?xml version=”1.0″ encoding=”utf-8″ ?> <rss 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=’60′ col=’1′ titlelen=’100′ orderby=’pubdate’} <item> <link>[field:arcurl/]</link> <title><![CDATA[[field:title function='html2text(@me)'/]]]></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><![CDATA[[field:description function='html2text(@me)'/] … <br /><b>文章分類</b>:[field:typename/]<br /><a href=”[field:arcurl/]” target=”_blank”>閱讀全文</a> | <a href=”[field:arcurl/]” target=”_blank”>評論回復(fù)</a>]]></description> </item> {/dede:arclist} </channel> </rss>
③,修改你的主頁模板index.htm在<head>和</head>之間加入一下標(biāo)記。
<link rel=”alternate” type=”application/rss+xml” href=”http://www.你的網(wǎng)址.com/rss.php” title=”網(wǎng)站標(biāo)題” /> ④,將rss.php文件上傳至根目錄,將rss.htm上傳至模版文件夾下default文件夾里。
這樣你從新生成一下主頁,就可以全站輸出啦。
2.讓sina微博關(guān)聯(lián)本站。
①,登陸sina微博,進(jìn)入上面 工具 》 關(guān)聯(lián)博客 》 選擇其他博客 》 把你的網(wǎng)址貼在框里 確定。