DedeCMS更新文章同步宣布到新浪微博

  假如在网站推广进程中能操作好微博这个东西的话,将会给网站的推广事情带来庞大的便利。下面以dede措施为例讲讲如何将网站内容自动同步到新浪微博。

  在新浪微博的东西中有个自动关联博客的成果,操作好这个成果将会是网站新宣布的内容自动同步到新浪博客。如下图所示:

DedeCMS更新文章同步公布到新浪微博

  在利用这个成果之前需要事先建造好你网站的rss feed,下面以dede为例讲授一下如何建造网站的rss feed。

  新建一个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."/default/feed.htm");
header("Content-type:application/xml");
$pv->Display();
?>

  再新建一个feed.htm文件,代码如下所示。将这个文件上传到dede的模板目次。

<?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)'/] … ]]></description>
</item>
{/dede:arclist}
</channel>
</rss>

  最后在index.htm模板文件中<head></head>之间增加如下语句:

<link rel="alternate" type="application/rss+xml" href=http://down.chinaz.com/"http:/www.qqshiwo.com/feed.php" title="你的网站名称" />

  在dede靠山从头生成网站首页,这样你网站的rss feed已经建造完了。

DedeCms下载:

织梦CMS(DedeCMS) v5.7 SP1 GBK build20150618下载

DedeCMS更新文章同步公布到新浪微博

DedeCMS更新文章同步公布到新浪微博

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10249.html