phpBB2HTML - Script to convert a phpBB forum into static pages
Each forum thread becomes an HTML page containing the message and the name of the author.
The script is extensible and can contain all the information provided by the database.
The generated HTML page looks like this:
In fact, the appearance depends on the css file.
SQL access to content of the forum
The name of each table is preceded by the contents of the variable $table_prefix. We use three tables in the database.
|# thread||Title||0 but if moved|
What we are interested in the thread table is the title of the topic, so the topic_title field, and the field topic_moved_to to be 0 if the thread is not moving, otherwise it is ignored.
The date is used in the query to rank the threads in chronological order when you select a set at once.
The request to read data from topic table:
if(intval($starting) == intval($ending))
$condition = "((topic_id = '$starting') AND (topic_moved_id = 0))";
$condition = "((topic_id >= '$starting') AND (topic_id <= '$ending') AND (topic_moved_id = 0))";
SELECT topic_id, topic_title, topic_moved_id FROM $tabletopics WHERE $condition ORDER BY topic_time ASC
|Date||ID of the author||Content||# thread|
To read the posts in a thread, we use this query:
SELECT poster_id, post_text, post_time FROM $tableposts WHERE topic_id='$id'
Then the date is formatted according to the variable $dateformat. We could also use the default_dateformat field in the config table.
From the id of the author of a post in the posts table, we get its name in the users table.
|The author ID matches poster_id in posts||Author name|
This requires an additional request:
SELECT user_id, username FROM $tableusers WHERE user_id='$posterid'
Installation and use
Download the archive and extract the contents to a local directory.
Four files including phpbb2html.php must be installed on the site containing the forum, at the root, in the directory containing the file config.php.
You can rename the script. This is recommended.
The script is run from the browser by typing the URL of the forum, for example:
The interface that appears to specify the thread id or all threads in an interval between two numbers.
Static pages are created in the same directory and URL of the pages are now displayed in the interface. Click on a title to see the generated page.
Download the script: