DedeCMS updated articles are simultaneously posted to Sina Weibo, dedecms Sina_PHP tutorial

WBOY
Release: 2016-07-12 09:03:54
Original
964 people have browsed it

DedeCMS update articles are simultaneously posted to Sina Weibo, dedecms Sina

If you can make good use of Weibo as a tool in the website promotion process, it will bring great benefits to the website promotion work. Come to huge convenience. Let's take the dede program as an example to explain how to automatically synchronize website content to Sina Weibo.

There is a function in the Sina Weibo tool to automatically associate blogs. If you make good use of this function, the newly published content on the website will be automatically synchronized to the Sina blog. As shown below:

Before using this function, you need to create the RSS feed of your website in advance. Let’s take dede as an example to explain how to create the RSS feed of the website.

Create a new feed.php file with the code as shown below. After saving, upload this file to the root directory of your website.

<?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(); 
?> 
Copy after login

 

Create a new feed.htm file with the code as shown below. Upload this file to dede's template directory.

<?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.ijinfa.cn[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.ijinfa.cn[field:arcurl/]</guid> 
<description><![CDATA[[field:description function='html2text(@me)'/] &hellip; ]]></description> 
</item> 
{/dede:arclist} 
</channel> 
</rss> 
Copy after login

 

Finally, add the following statement between in the index.htm template file:

<span class="sh_symbol"><link rel<span class="sh_symbol">=<span class="sh_string">"alternate" type<span class="sh_symbol">=<span class="sh_string">"application/rss+xml" href<span class="sh_symbol">=<span class="sh_string">"http://www.ijinfa.cn/feed.php" title<span class="sh_symbol">=<span class="sh_string">"你的网站名称" <span class="sh_symbol">/> </span></span></span></span></span></span></span></span></span></span>
Copy after login

Regenerate the website homepage in the dede background, so that the RSS feed of your website has been created.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1077134.htmlTechArticleDedeCMS update articles are simultaneously posted to Sina Weibo, dedecms Sina if it can make good use of Weibo in the process of website promotion Tools will bring great convenience to website promotion work...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template