Recently, when creating a website, you need to generate static pages. However, some content in the generated static pages must be obtained dynamically ..
Finally, I checked it online and added a summary .... Finally .. We will study it together .. Oh...
<SPAN class = "style1"> Application 1 </span>: Article Count to get Dynamic Content
Count page: Count. php
CopyCode The Code is as follows: <? PHP
Require_once './global. php ';
$ Db-> query ("Update ". $ tablepre. "teacher set views = views + 1 where id = '". $ _ Get ['id']. "'");
$ Hello = $ db-> fetch_one_array ("select * from". $ tablepre. "teacher where id = '". $ _ Get ['id']. "'");
$ Hcount = $ Hello ['Views '];
?>
Document. Write ("<? = $ Hcount?> ");
Add it to the static page mk.html.
<SCRIPT src = "count. php? Id = <? = $ ID?> "> </SCRIPT>
Remember: The page path will change after the static count file is generated ..
<SPAN class = "style1"> Application 2 </span>: obtains dynamic information on this page, such as related articles.
Similarly, links in static pages are still in this form.Copy codeThe Code is as follows: <SCRIPT src = "read. php? Cid = <? = $ A ['code']?> "> </SCRIPT>
The content in read. php is as follows: Copy code The Code is as follows: <? PHP
$ Cid = $ _ Get ['cid'];
?>
Document. Write ("<Table cellspacing = 1 cellpadding = 8 width = 100% bgcolor = # c4cbce border = 0> ");
Document. Write ("<tr bgcolor = # ffffff align = center> ");
Document. Write ("<TD width = 33% align = center bgcolor = # ffffff> order number </TD> ");
Document. Write ("<TD> Grade </TD> ");
Document. Write ("<TD> time </TD> ");
Document. Write ("</tr> ");
<? PHP
$ Succquery = $ db-> query ("select * from". $ tablepre. "test where cid = '$ cid '");
While ($ succ = $ db-> fetch_array ($ succquery ))
{
?>
Document. Write ("<tr bgcolor = # ffffff align = center> ");
Document. Write ("<TD> <? = $ Succ ['id']?> </TD> ");
Document. Write ("<TD> <? = $ Succ ['city']?> </TD> ");
Document. Write ("<TD> <? = Date ('Y-m-d h: I: s', $ succ ['addtime'])?> </TD> ");
Document. Write ("</tr> ");
<? PHP
}
?>
Document. Write ("</table> ");
Document. Write ("<br> ");
another method:
static side: copy Code the code is as follows:
dynamic page:
fill in any thing that is dynamic without document. write ()