search
HomeCMS TutorialDEDECMSHow to automatically update DEDECMS site content to Sina Weibo

How to automatically update DEDECMS site content to Sina Weibo

How to automatically update the content of the DEDECMS site to Sina Weibo?

The content of the DEDECMS site is automatically updated to Sina Weibo

Recommended learning: 梦Weavercms

Sina Weibo uses feed to find updated articles. Just specify the feed address for him and he can be successfully associated.

Now let’s start with a simple modification of Dreamweaver’s template. Since Dreamweaver cannot generate the entire site’s XML file, we must first create a PHP program that generates the entire site’s XML.

1. Create 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();   
?>

The above thing to note is to modify the path of the template to ensure that feed.htm can be found in the template and directory

2. Create feed. htm template file

<?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=&#39;html2text(@me)&#39;/]]]></title>   
<author>[field:writer/]</author>   
<category>[field:typename/]</category>   
<pubDate>[field:pubdate function=&#39;strftime("%a, %d %b %Y %H:%M:%S +0800",@me)&#39;/]</pubDate>   
<guid>[field:arcurl/]</guid>   
<description><![CDATA[[field:description function=&#39;html2text(@me)&#39;/] … ]]></description>   
</item>   
{/dede:arclist}   
</channel>   
</rss>

It should be noted that don’t forget to change my URL to what you need.

3. Modify the index.htm home page template

Since Sina Weibo can only verify the URL and cannot write the full path, for example, I wrote:. The result indicates that the association failed. The solution is to add the following code

<link rel="alternate" type="application/rss+xml" href="" title="你的标题" />

between

and . Through the above method, you can successfully associate with Sina Weibo.

The above is the detailed content of How to automatically update DEDECMS site content to Sina Weibo. For more information, please follow other related articles on the PHP Chinese website!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.