Home  >  Article  >  Backend Development  >  PHP generates HTML static page example code_PHP tutorial

PHP generates HTML static page example code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:49:591076browse

Developed for the cd2sc.com website function, the code is original and the generation speed is average.
(For well-known reasons, the names of data fields related to the database have been changed, and the parameter filtering part has been removed for code clarity)

Note: The original dynamic address is moban.php?id= 1, the generated address is html/200808/sell_1.html. page.php is the paging program, which is published in this blog.
How to use the page, save this code as make.php, and use the browser to access make.php?t=quantity&pg=page; for example, make.php?t=300&pg=2, that is, 300 items are generated each time Data is generated starting from page 2 of the data list, that is, skipping the first 300 items. If you access make.php directly without adding any parameters, 200 items will be generated each time by default, starting from the first page.

Copy code The code is as follows:

if($_GET[pg]=='' ){
$aa=1;
}else{
$aa=$_GET[pg];
}
include("admin/conn.php");
require_once ("page.php");
$result=mysql_query("select * from 2carsell ");
$totle=mysql_num_rows($result);
$pagelist = $_GET[t];
if($_GET[t]==''){
$pagelist='200';
}else{
$pagelist=$_GET[t];
}
$ pager = new Pager($totle,$pagelist);
$datastat=" Total".$pager->countall." items, each time generate". $pager->countlist." items, a total of ".$pager->page." times" need to be generated;//Data Statistics
$bb= $pager->page;
$pagenav=$pager->backstr.$pager->thestr.$pager->nextstr;
$limitFrom = $pagelist*($pager->pg -1);
$result=mysql_query("select * from 2carsell ORDER BY id DESC limit $limitFrom,$pagelist");
?>
The page is being generated..


print "










$aa=$aa+1;
if($aa> ;$bb){
echo 'Congratulations, all pages have been generated! ';
echo "<script>alert('All documents have been generated/updated! ')</script>";
}else{
echo "<Script> window.location='make.php?t=$pagelist&pg=$aa'; </script>";
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319435.htmlTechArticle is developed for the cd2sc.com website function. The code is original by me and the generation speed is average. (For well-known reasons, the names of data fields related to the database have been changed, and in order to represent...
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