3.3. How do I add my own footer and header so that I can integrate my forums into design of the rest of my website?
For this purpose, PunBB has a simple template system. The template files are located in include/template/. There are three templates - main.tpl, maintenance.tpl and redirect.tpl. The file main.tpl contains the template for almost all pages that are displayed in the forum, the file maintenance.tpl is the template for the message page that is displayed when the forum is put in maintenance mode, and finally the file redirect.tpl is used to display the redirect pages e.g. when logging in or when posting a message.
The templates contain variables that are replaced with actual content when a page is displayed. All variables in PunBB are enclosed in less-than and more-than signs (< and >). For example, the variable for the title of the forums is called <pun_title>. When PunBB displays the index page, it reads the file main.tpl and replaces <pun_title> with the title of the forums. There are 11 replacement variables in main.tpl.
If you want to customize the look of PunBB so that it fits the design of other pages on your website, it is primarily the template files you should edit. For example, if you wanted to add your own logo at the top of all forum pages, you would edit main.tpl and add HTML for displaying your logo at the appropriate position in the file. It is possible to include PHP scripts from the templates. See the next FAQ entry for more info on that.
3.4. Is it possible to include my own PHP scripts in the templates?
Yes. PunBB has a special replacement variable called pun_include for including scripts in the templates. For example, if you wanted to include a script called banner.php (located in the forum root directory) at the bottom of all forum pages, you would add the following to your template files:
<pun_include "banner.php">
The path to banner.php is relative to the forum root directory. PunBB will execute the script and the pun_include variable will be replaced by any output that the script produces. Please note that all included scripts have access to the PunBB variables, so if you e.g. wanted to access the database, you could use the $db object just like the rest of PunBB does. Replacement of the pun_include variable is the last thing that PunBB does when it outputs a page, so you don't have to worry about not using variable names that PunBB uses.
3.5. I want to display information from the forums on my website's front page. How can I do this?
The script extern.php found in the forum root directory can output various bits of information from the forums. This script can be called via a PHP include command or through the use of Server Side Includes (SSI). For more information on this, see the usage instructions at the top of the script extern.php.
3.6. Does PunBB provide RSS feeds for recent discussions?
Yes. The script extern.php can produce RSS 0.91 feeds on recent discussions. For example, to syndicate news about the 15 most recently active topics, visit the URL:
http://path.to.forum.root/extern.php?ac … p;type=RSS
To receive news about the 15 newest topics, the URL is:
http://path.to.forum.root/extern.php?ac … p;type=RSS
More information on the different possibilities can be found in the usage instructions located at the top of the script extern.php in the forum root directory.