Home  >  Article  >  CMS Tutorial  >  How to use the DEDE Dreamweaver planning task function to regularly update the homepage

How to use the DEDE Dreamweaver planning task function to regularly update the homepage

藏色散人
藏色散人Original
2019-12-09 09:54:162082browse

How to use the DEDE Dreamweaver planning task function to regularly update the homepage

How to use the DEDE Dreamweaver scheduled task function to regularly update the homepage?

dedecms Dreamweaver system has a plan in the background I believe many people don’t know how to use the task function, and there is no detailed explanation. Here we will use a practical case to explain how to use scheduled tasks to automatically update the homepage of the website every 5 minutes.

Recommended learning: 梦Weavercms

Regularly update the homepage index.html file. The advantage of updating is that when search engine spiders crawl index.html, Status code 304 will not be returned. The search engine will determine the update time of your HTML file and compare it with the previous index time. If there is an update, it will be included. If there is no update, it will set the 304 status and not update.

The following is a detailed description of how to use scheduled tasks:

First enter the background-system-scheduled task management

After entering, you can see an instruction for executing scheduled tasks:

Instructions for scheduled task execution

In order to ensure that the task can be fully executed, it is recommended to use Dede's client tool, otherwise it can only be triggered through JS, but there are many uncertain factors in JS triggering that will cause the task to not be completed. ;

JS triggering method: Use JS to call /plus/task.php?client=js in all document pages (the password for scheduled tasks must be disabled, system configuration parameters-> other options);

Customize your own client: Directly access "http://website/plus/task.php?clientpwd=Management Password", which will return the URL of one of the executable tasks (if there is no available task, the string: notask will be returned), and then The client can run this URL.

Next we create a new scheduled task. The task needs to have a PHP execution file to generate the website homepage:

plus.zip

How to use the DEDE Dreamweaver planning task function to regularly update the homepage

Upload the dede-post.php file after unzipping the attachment to plus/task/ in the website directory

In order to update the website every 5 minutes, we also need to modify the file plus/task/ task.php

Open task.php and change the $daylimit parameter to 300 seconds - $daylimit = 300; if you need to change it to other times, you can modify it yourself and then upload it. At this point, the conditions for basic task execution are all there, but there is still a trigger method. Here we choose to use the JS file triggering method, which can be triggered as long as a visitor accesses it. If your website is often visited by no one, you can only manually access the trigger.

We copy the code: and put it in the bottom template footer.htm .

In this way, every time someone visits your website, this JS will be triggered, allowing your execution program to run, that is, the website will automatically update.

The above is the detailed content of How to use the DEDE Dreamweaver planning task function to regularly update the homepage. 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