Sometimes, if some functions of a system need to be operated once every time, is it very troublesome? For example, generate homepage html, generate column list, etc. Because dream weaving uses static mode, of course, it can also be set to dynamic mode. However, the dynamic column list is not good for SEO. Therefore, if it is static, you need to generate a column list after publishing a document. If the static mode used by the home page also needs to generate a home page and other similar repeated functions, Is there any way to let the dream weaving program do it automatically so that our hands can be freed?
The answer is yes. A task planning function is provided in the dream weaving system, as shown in the following figure:
Just add one, and then add<script language="javascript" src="/plus/task. php? Client=js"></script>in all templates, namely footer.htm, to realize the plan task. Next, we will create the plan task step by step. The use of js is only one way to create planned tasks, and the other way is to use Dede's client tools.
Add a planned task:
1. Click "[Add a New Task]" in "Planned Task", as shown in the following figure:
2. Fill in the information of the planned task:
Task name: Regularly review and update the home page
Run program: The dede-post.php program must be placed in/ The plus/task directory, so fill in the file name
Any instructions: Describe what this is to do, so that if you add any more in the future, you can easily understand what this is to do.
Enable: Do you mean to enable this scheduled task
Circulation mode: It refers to the cycle mode used to execute planned tasks
Execution time: When to execute this task
Execution cycle: It refers to what task execution cycle
Start time: When to execute any
End time: When will it end and how many days will it be executed? For example, one month. If one month later, nothing will be executed.
Additional parameters: The parameters sent to the running program are used. We don't usually use this.
The completed plan tasks are as follows:
3. Click "OK", as shown in the figure below, and the task has been added.
JS trigger mode:
However, it is not over yet. We need to add the generated js code of this task:<script language="javascript" src="/plus/task. php? Client=js"></script>to the template footer.htm.
Please note that the running time of the newly added scheduled task in the figure above shows that it has not run yet. Now let's refresh the home page, which is equivalent to running once. Let's look at the running time again, as shown in the figure below:
Is already running.
Now let's test whether this planned task can be used. For the convenience of testing, I first set the "Home Mode" of the website home page to "Generate Static". If there is no planned task, we need to generate it manually. Now with this planned task, we will publish a document to see if it can automatically generate the home page for us.
I publish a document as shown below:
Then, refresh the homepage. Please note that I am not generating homepage html. Let's go to the homepage of the website, as shown below:
The document planning task just released has been processed for us.
Custom client:
The above is a js file that triggers js through the user's visit to the website. The dream weaving system provides another way to achieve the task planning, that is, customizing the client trial.
Adding a scheduled task is exactly the same as above. After adding, execute: http://website/plus/task. php? Clientpwd=manage the password, you can trigger the planned task. This method is officially recommended, but it is not convenient for js. You need to manually enter this URL, while the js method can trigger js to execute the planned task without any attention.
Of course, although this is triggered by manual input, it is more convenient than manually executing tasks executed by programs.
As shown in the figure below:
This is the result of the client execution mode of the scheduled task added above. The prompt is triggered successfully. Pay attention to the above URL.
The management password here is written casually, and you can define it yourself.
Reprint: http://www.dedebase.com/thread-880-1-1.html