Home  >  Article  >  Backend Development  >  tmal PHP generates HTML static page example code

tmal PHP generates HTML static page example code

WBOY
WBOYOriginal
2016-07-29 08:38:431562browse

Developed for the cd2sc.com website function, the code is original and the generation speed is average.
(For well-known reasons, the data field names 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, and 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 pieces of data are generated each time. Start generation from page 2 of the data list, that is, skip the first 300 items. If you directly access make.php 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.", 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");
?>

No. The page is being generated..


print "


< ;br>



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

The above introduces the example code of tmal PHP to generate HTML static pages, including tmal content. I hope it will be helpful to friends who are interested in PHP tutorials.

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