Home >CMS Tutorial >DEDECMS >How to determine whether a dedecms article is included or not
If you want to know more about dedecms. You can click: DEDECMS tutorial
dedecms background query whether the article is included in Baidu, this is a small function, online There are also similar functions made by other experts, but the ones I found all charge a fee, and in my opinion are very expensive and bloated. They use ajax for dynamic updates, which I feel is unnecessary. As long as the article is included in Baidu, it is not updated every day. All we need to know is whether this article has been included. Maybe you can check it once a month or once a week. You don't need to check it every time you open the list, which consumes too many resources. Based on this, I am not very talented, so I pieced together this small function without borrowing anyone else's program. I am also a newbie in PHP and know very little about PHP. Maybe the program is not perfect enough, but in my opinion, it is indeed enough.
Note: Due to poor consideration, the address of the internal page of the website is not in a pseudo-static form. It will be very troublesome to use. Please be careful when downloading.
First of all, here is the rendering:
1. Understand the functions implemented by this plug-in.
DEDECMS background query plug-in to query whether articles are included in Baidu is based on the document batch maintenance function in the dede background. It adds a field kdate to the main data table archives to store Baidu snapshot data. , the background queries whether each article has a snapshot in Baidu. If it does not exist, it will be written as not included. If it exists, the snapshot date will be written.
2. Specific implementation method
#1. Download the compressed package, decompress it to get the module file, upload the module in the background and install it .
2. The plug-in cannot be used normally after installation. You need to do the following operations: (Note: The reason why the plug-in cannot be used after installation is because the author’s background files have been changed, not The original one, and I don’t want to replace the original one. I am afraid that there will be problems after the user installs it, so the module package does not include the template.)
Open the backend directorydede/templets/content_batch_up.htm
, find: "Delete Document" four words, add below it:
<input name="action" type="radio" class="np" id="delradio" value="zhizhu" onClick="ShowHideMove()" /> 验证是否被百度收录
This is mainly to add the "Verify whether it is included by Baidu" option in the Core-Batch Maintenance-Document Batch Maintenance page. This plug-in is based on Document batch maintenance function, as shown below:
Open zhizhu.php and find:
$domain = "http://www.daimajiayuan.com/sitejs-".$id."-1.html";/*欲查询的页面*/
The author does not know what your page address is, so he needs you Change it manually. $id is the ID of the article. The code in double quotes on both sides can be changed according to your own URL. If you use pseudo-static, it is the easiest. If it is a dynamic address, such as this address:
http://www.xxx.com/plus/view.php?aid=11824
needs to be changed to:
$domain = "http://www.xxx.com/plus/view.php?aid=".$id;/*欲查询的页面*/
Open the dede/templets/content_list.htm file and find:
colspan="10"
Change to:
colspan="11"
(Students who know html should understand.) This is the beginning of adding table columns. Find
<td width="8%">权限</td>
and add at the end:
<td width="8%">快照日期</td>
Grasp this percentage yourself, and then Find again:
<td>{dede:field.arcrank function="GetRankName(@me)"/}</td>
Add:
<td>{dede:field.kdate/}</td>
Open content_list.php and find:
$query = "SELECT arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,
Add
arc.kdate,
after the half-width comma. Here, The code changes are complete. Go to the backend to try out the function.
In Core--Batch Maintenance--Document Batch Maintenance, you can choose to do it by column or ID range, as shown in the above picture, the following picture will be displayed after it is completed.
#After completing the query, you will know that your article has not been included. According to my own usage, it takes about 40 minutes to query 1W articles. The accuracy rate is above 99%. Why do we say this? Due to network reasons, some URL crawling may time out and be skipped. But we have tried our best to avoid it in the program. In this case, do not spray.
The above is the detailed content of How to determine whether a dedecms article is included or not. For more information, please follow other related articles on the PHP Chinese website!