1. When you add records in the background, the target HTML page is generated directly, and the foreground call connection directly points to the generated HTML page. The advantage of this approach is that the program is most efficient.
Server load is light, but because the generated is a pure static page, once the page style (stencil and css=theme) on the changes must be rebuilt all content pages.
So the actual use of the application is generally not too much. More is the use of js,ssi,xml/xsl and other client tools, the generated static file to save only data, does not involve style,
This can achieve speed and maintenance of the balance, but relative to the front and back of the program to be more complex (when applied this method, because the content is pure static, can be paired with the single compiled static Apache use. Better efficiency and resource consumption than includes dynamic content support
====
Add:
A. The change style mentioned above, to regenerate all the content pages, you can pass:
>>>> to determine whether the page needs to be rebuilt by embedding a <script src=xxx.php?id=xxx&template=red></script> within each generated page.
>>>>apache's ErrorDocument404 function, but here the foreground link is pointing to HTML, if the HTML does not exist, will be through the Apache file does not exist redirect to the 404 handler function to regenerate the HTML
(Note: httpd.conf plus errordocument 404/errprocess.php instructions), this feature can be used to modify the style of the site, to update all the generated HTML file problems,
Remove the entire static folder.
B. The way to invoke PHP by embedding <script></script>js, change many places that need to change (such as CTR)
2. Front access link to the PHP program, the PHP program first check whether there is a corresponding static file. If the static file does not exist. is generated and redirected to this file, otherwise direct redirection.
This method is actually used in conjunction with the Url_rewrite function of Apache. The PHP file address is displayed in the form of HTML, which is advantageous to search engine retrieval.
This method has a slight loss in efficiency, but the program structure is simple and easy to adjust, it is suitable to use when the traffic is not very large.
Precautions:
All generated HTML files are centrally placed in one folder, and it should also be noted that if there are many words (such as a forum) for generating files, accessing one of the HTM files will become very slow,
Then it's best to pass
>>>> separate folders by date, such as static/2004/11/18/0001.htm
>>>> The Post ID is str_pad based on the length of the field in the database: for example, the ID is 123456, the database is int (11), and the ID processing is 00000123456. Considering that Linux generally the same file to reach four digits will have performance impact, cut it, the final path for static/00/000/123/456.html