本文介绍了织梦dedecms怎么将文章自动推送到新浪微博,解决思路:先新建个PHP文件,将教程给出的代码放到里面,然后再建个HTML文件,同样把代码放到里面,最后使用调用就可以了。
织梦dedecms怎么将文章自动推送到新浪微博?其实92建站以前介绍过内容自动推送到新浪微博的方法,有些人说看不懂,今天就再来展开说说,用更详细的步骤向大家介绍织梦文章推送微博的方法。
处理办法:
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 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>
需要注意的是,别忘了把我的网址改成你自己需要的。
3,修改index.htm主页模板
由于新浪微博只能验证网址,不能写完整路径,比如我写的结果提示关联失败,解决的办法是,在<head>和</head>中间加入下面的代码
<link rel="alternate" type="application/rss+xml" href="" title="你的标题" />
通过以上方法就可以成功关联新浪微博了。
上面就是织梦文章推送微博的介绍,若有疑问可以找小编进一步探讨交流~