Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
Today we went on to weave the dream tutorial, everyone do seo know the site's updated frequency directly determines the site's collection speed and a part of the site weight, but we can not update in real time, in this era of technology so advanced if we are still using the most primitive way it must be a tragedy. Yes, as the title is written, automatic, yes is automatic, Automatic Updates the first page of the article list.
The first step is to call a random article:
The dream gives a random article the parameters of the call are 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 out random articles, and will change every time the dynamic page is refreshed, but because the dream is the first generation of static HTML, so if not to manually generated or not change, so the following method is used.
The second step is to set the scheduled automatic update file:
Copy the following code and paste it into a new file named: autoindex.php, uploaded to the FTP plus folder, and see clearly that it is in the plus folder and that the wrong location will not take effect:
< PHP
function Sp_input ($text)
{
$text = Trim ($text);
$text = Htmlspecialchars ($text);
if (!GET_MAGIC_QUOTES_GPC ())
Return addslashes ($text);
Else
return $text;
}
$autotime = 3600;//Automatic Update time, in seconds, here I set for an hour, you can change.
$fpath = ". /data/last_time.inc//Record the update time file and, if not, check for Read permissions.
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 (dedeadmin.) /.. /include/common.inc.php ");
Require_once (dedeinc.) /arc.partview.class.php ");
/*
$row = $dsql->getone ("SELECT * from Dede_homepageset");
$dsql->close ();
$templet = $row [' Templet '];
$position = $row [' position '];
*/
$templet = "tnbjh/index.htm";//This is the first page template location, currently the Dede default first position.
$position = ". /index.html ";
$homeFile = DirName (__file__). /". $position;
$homeFile = Str_replace ("\", "/", $homeFile);
$homeFile = Str_replace ("//", "/", $homeFile);
$PV = new Partview ();
$PV-> Settemplet ($cfg _basedir. $cfg _templets_dir. " /". $templet);
$PV-> savetohtml ($homeFile);
$PV-> Close ();
$file = fopen ($fpath, "w");
Fwrite ($file, "
Fwrite ($file, "\ $last _time=". Time (). "; \ n ");
Fwrite ($file, '?> ');
Fclose ($file);
}
? >
Then we need to add a piece of code to the template code head tag on the home page:
< script src= "/plus/autoindex.php" language= "javascript" ></script >
Then click the background generation, update the home page. So wait for the validation results, one point to see the note above, the time is in seconds, the default 3,600 seconds is an hour, you can change. The above methods after I personally tested effective, we can rest assured that the problem, wishful question, leave a message.