I have a site that is intense enough for the database, so I try to reduce the use of the database where possible. One place I want to do is in every thread of my forum.
Instead of dynamically generating each thread each time it is viewed, I was thinking of creating a static version of each thread that will be overwritten anytime a new post is created. Each stream will be stored in the / html / forum folder, and threads that have not been edited for 3 or more days will be moved to the / html / forum / archive folder (therefore file_exists do not need to search through 5000 html files each time for widely viewed streams )
Here is an example of what the new thread page will look like:
require_once('header.php'); if(file_exists('/html/forum/'.$thread_id.'.html')) { require_once('/html/forum/'.$thread_id.'.html'); } elseif(file_exists('/html/forum/archive/'.$thread_id.'.html')) { require_once('/html/forum/archive/'.$thread_id.'.html'); } else {
The forum is just one example, but I thought about it with most of the pages on my site. Are there any significant disadvantages or advantages of this method for dynamically creating content every time?
Thanks!
source share