织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

织梦模板dede增加外连接技巧更新文章同步发布到新浪微博

织梦园模板 / 2020-02-18 / 收藏
 如果在网站推广过程中能利用好微博这个工具的话,将会给织梦dedecms网站的推广工作带来巨大的便利。

下面以织梦dedecms程序为例讲讲如何将网站内容自动同步到新浪微博。 

 
在新浪微博的工具中有个自动关联博客的功能,利用好这个功能将会是织梦dedecms网站新发布的内容自动同步到新浪博客。
 
在使用这个功能之前需要事先制作好你网站模板的rss feed,下面以dede为例讲解一下如何制作网站的rss feed。 
 
新建一个feed.php文件,代码如下所示。保存后将这个文件上传到你织梦dedecms网站的根目录。 
<?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>http://www.baidu.com.com[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>http://www.baidu.com[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://www.baidu.com/feed.php" title="你的网站名称" /> 
 
在dede后台重新生成网站首页,这样你网站的rss feed已经制作完了。访问一下

相关标签调用

收缩