织梦dedecms站点内容如何同步更新到站长微博

最近注册了新浪微博,发现特别有意思,发现里面有一个工具可以关键到站外的博客站点,这样每当有更新,微博就会自动更新啦。

于是把自己用织梦做的站网址写进去,解决提示:无法关联,然后用填了一个用wp做的站,提示关联成功!通过对比得知,新浪微博是利用feed找到更新文章的。只要给他指定feed地址就可以成功关联啦。

现在开始动手简单修改一下织梦的模板 ,由于织梦不能生成全站的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 . "/3ppt_com/feed.htm"); 
header("Content-type:application/xml"); 
$pv->Display(); 
?> 
以上要注意的是修改模板的路径,确保在模板跟目录能够找到feed.htm

2,建立feed.htm模板文件
<?xml version="1.0" encoding="gb2312" ?> 
<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.3ppt.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.3ppt.com[field:arcurl/]</guid> 
<description><![CDATA[[field:description function='html2text(@me)'/] … ]]></description> 
</item> 
{/dede:arclist} 
</channel> 
</rss> 
需要注意的是,别忘了把我的网址改成你自己需要的。

3,修改index.htm主页模板

由于新浪微博只能验证网址,不能写完整路径,比如我写的是:http://www.3ppt.com/feed.php。结果提示关联失败,解决的办法是,在<head>和</head>中间加入下面的代码

<link rel="alternate" type="application/rss+xml" href="http://www.3ppt.com/feed.php" title="你的标题" />

通过以上方法就可以成功关联新浪微博了。

转载自:http://www.3ppt.com/Code/DedeCms/13656.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值