The webmaster knows that the update frequency of the website's home page directly determines the website's collection speed and some site weights, but it cannot be updated in real time. In such a technologically advanced era, it must be a tragedy if the most primitive method is still used. Yes, as the title says, it is automatic. Yes, it is automatic. It automatically updates the list of articles on the home page.
Step 1: Call random articles:
DedeCms The parameters of random article call are given as follows:
{dede:arclist sort=’rand’ titlelen=48 row=16}
<li><a href="[field:arcurl/]" title="[field:title/]" target="_blank">[field:title/]</a></li>
{/dede:arclist}
This list code can call random articles, and it will change every time the dynamic page is refreshed. However, because Zhimeng generates static html from the home page, it will not change if it does not generate it manually, so the following method is used.
Step 2: Set the file to be automatically updated regularly:
Copy the following code and paste it into a new file named: autoindex.php , upload it to the ftp plus folder. It is clear that the plus folder will not take effect if the location is wrong:
<? php
function sp_input( $text )
{
$text = trim( $text );
$text = htmlspecialchars( $text );
if (!get_magic_quotes_gpc())
return addslashes( $text );
else
return $text;
}
$autotime = 3600;// The time is automatically updated in seconds. Here I set it to one hour, and you can change it yourself.
$fpath = "../data/last_time.inc";// Record the update time file. If the purpose cannot be achieved, please check whether you have read permission.
include( $fpath );
if( empty($last_time))
$last_time = 0;
if( sp_input($_GET['renew'])=="now")
$last_time = 0;
if((time()-$last_time)>=$autotime )
{
define('DEDEADMIN', ereg_replace("[/\]{1,}",'/',dirname(__FILE__) ) );
require_once
Statement: All articles on this site, unless otherwise specified or marked, are originally published on this site. No individual or organization is allowed to copy, embezzle, collect and publish the content of this website to any website, book and other media platforms without the consent of this website. If the content of this website infringes upon the legitimate rights and interests of the original author, please contact us for handling.