PHP Tutorial article content pagination and generate corresponding HTM static file instance
$tmpBody = "FJKA;FJSA; {page} batch generation divided into files and plus paging code ";
$tmpUrl = ' www.jzread.com ';
$tmpUrlarray = Explode ('. ', $url);
$tmpArray = explode (' {page} ', $tmpBody);
$total = count ($tmpArray);
if ($total >1)
{
$tmpStr = ';
for ($i =0; $i < $total; $i + +)//traverse all paging
{
if ($i ==0)
{
$str. = "<a href=". $rs [' S_url ']. ' Class=bodypage target=_self> '. ($i + 1). ' </a> ';
}
Else
{
$str. = "<a href=". $rs [' id ']. ' _ '. $i. htm class=bodypage target=_self> '. ($i + 1). ' </a> ';
}
}
//batch generation into file and plus paging code
$str = ' <div class=mupage> '. $str. ' </div> ';
for ($j =0; $j < $total; $j + +)
{
if ($j ==0)
{
$fname = $rs [' id ']. HTM ';
}
Else
{
$fname = $rs [' id ']. _ '. $j. htm ';
}
$tempMu = Str_replace (' {htmlcontent} ', $tmpArray [$j]. $str, $tempLate);
makehtml ($tempMu, $filePath, $fname); This function does not explain that a file creation code
}
$mupage = 1;
}
$tempLate = Str_replace (' {htmlcontent} ', $tmpBody, $tempLate); Ordinary articles are saved to an array regeneration page address with {page} paging, and then the HTM page is generated from the contents of the array based on explode, and the original site is reproduced with the source www.jzread.com
$total = 0;
$str = ';
$i = 0;
$j = 0;
/*
This code generation principle is id_ page number such as 100_1.htm,100_2.htm, first of the
*/
?>