One of the easiest ways to customize the appearance of your forum is to download and install a new phpBB style. Hundreds of different styles have been created based on topics like color schemes, popular movies, television shows, hobbies, sports, etc. The majority of these styles are free to download and use, although there are also some commercial styles and style designers available. Some websites that offer style downloads also provide demonstration forums in which you can preview any of the styles without downloading anything. Two of the best websites for downloading phpBB styles are:
Remember, some online communities use the terms template or theme when referring to a complete style, rather than names of style elements.phpBBHacks.com tends to use template in this manner.
Be certain to select a style that is compatible with the version of phpBB that you are using. The two sites above will list the compatible phpBB versions for each style, but other sites may not. Also keep in mind that some other sites carry styles for special ported versions of phpBB that are used with content management systems like PHP-Nuke. Those styles will not be compatible with an original flavor phpBB forum and vice versa.
Once you have selected and downloaded a new style, you will need to install the style to your forum. The installation is not a hard process if everything is prepared properly.
You will however find it a bit daunting if the process or the creation of the style has been handled incorrectly.
Most downloads will come in a ZIP file format. Before you can install a downloaded style, you need to decompress the ZIP file. There are various software programs you can use to accomplish this task. If you downloaded phpBB in a ZIP file, you are most probably already familiar with decompressing a file. Even if you are not, there are many decompression software programs you can download. Some of the more famous names include WinZip, WinAce, and WinRAR. Some, like ZipGenius (http://www.zipgenius.it/) or XAce, are free. WinZip has a Wizard mode that is very easy to use, so we will not look at decompression in great detail here.
For the purposes of illustration, this chapter will discuss the usage of a sample style called subBook. Instead of downloading and uncompressing this style, it was created as a quickly renamed copy of the subSilver style. If you would like to create your own subBook style so you can follow along, follow these simple instructions.
2. Change the name of the copy directory to
3. Rename the
subSilver.css files to
4. Open the
theme_info.cfg file for editing. In this file, you will see
subSilver used several times. Change each of these instances to
subBook. Take care that you do not delete or change anything else in the file. Remember to follow the proper editing procedures you learned earlier.
5. The name of the subSilver style is referenced in around forty to fifty lines inside template files in your
subBook directory. The exact files and number of times vary depending on the version of phpBB 2.0 you are using. When creating a new style from subSilver as we are doing, you need to change all these references to the name of the new style (subBook in our case). Clearly, this step will take some time. This will not affect our installation or uninstallation examples, so you may skip most of this for now. Some advanced text editors have special search and replace features that can help you do this more quickly. At the very least, do these steps on the
6. Save and close all open files.
Every style available for phpBB is based around a set of files stored in the
templates directory. The easiest way to create a new style is to copy the files of another and make a few changes to some of the copied files. These files are the configuration files, such as
theme_info.cfg, which phpBB uses for installing and managing styles. The Cascading Style Sheet file,
subSilver.css in this case, was also renamed. As a result, references to
overall_header.tpl also had to be changed to the new name of that file. Completing these steps gives you a new style, which you can edit as much as you like without affecting your forums’ other styles.
Once you have a new style to install, either from downloading or copying
subSilver, you need to place that style’s directories and files into the
templates directory of your forum. phpBB’s Administration Control Panel can automatically detect all styles placed into this directory. If your forum is on a remote server, as most forums and websites tend to be, then you will have to upload the directories and files to that server via one of the methods supported by your web hosting company. This is usually through File Transfer Protocol (FTP), SSH, or some other setup. Once you have copied or placed the files into
templates, you have completed two thirds of the style installation already:
With the new style’s files placed in your forum file system, you are now ready to install the style through phpBB’s Administration Control Panel. Log in to your forum using an administrator account and enter the Control Panel. In the navigation menu frame, scroll down to the Styles Admin section. There are several options here; we are only interested in the Add link for the moment. Click this link to enter the Styles Administration page.
The Styles Administration page lists all the uninstalled styles phpBB has detected in your
templates directory. You may notice that this page uses both theme and style to refer to the styles. This confusion stems from the fact that we have already installed the image set and template style elements simply by placing them into the
templates directory. All that remains is to install the theme element, and thereby complete the style’s installation. To install a theme, just click the Install link next to the entry in the list. phpBB will now show the style in the drop-down selection list found in user profiles and the phpBB configuration page:
phpBB is a complicated set of scripts, so even something that should be simple, like installing a style, can cause you problems. There are many causes of these problems, ranging from designer mistakes to errors in the copying of the files, but all of them are easy to fix. Let us examine some of the more common troubles encountered by forum administrators in the past.
If a style does not appear in the Styles Administration page after you have copied it to the
templates directory, there is usually a problem with the
theme_info.cfg file that should be in the style’s directory. Make sure this file has been copied and that the name of the file has not been changed. If the file is present and named correctly, then there is a problem inside the file itself. Some styles have been distributed with errors in this file.
theme_info.cfg for editing. It should resemble the subSilver file shown in the figure that follows. Note that each line begins with
$subSilver, followed by other characters. The
subSilver part is extremely important, and must be spelled in exactly the same manner as the name of the style’s
templates directory and cannot contain any spaces. The name will be different for each template, of course. phpBB will consider all of these to be completely different things:
This screenshot shows a portion of an unaltered subSilver
theme_info.cfg. Only our first option,
subSilver, would be correct in this instance. Check each line of
theme_info.cfg and make any corrections needed to the file or, if necessary, rename the style’s
templates directory. In certain cases, the latter will be an easier method of correcting the problem. Other styles will have different names for their directory and in
theme_info.cfg, but the name must be the same in both places.
Sometimes phpBB may have trouble finding the configuration file for a template element. When this happens, either during installation or normal forum operations, the forum will present the user with a Critical Error message, as shown in the following figure, mentioning the name of the template. That name is a very important part of this error message, because it is telling you what name phpBB has used to look for the configuration file. When the name of the template is shown as subSilver, phpBB could not find a file called
subSilver.cfg in the
templates/subSilver directory. Similarly, the name subBook means phpBB looked for
subBook.cfg in the
templates/subBook directory. The pattern here should be clear:
To repair this error, you need to ensure that phpBB can find the file in question. As with the error when the style does not appear in Styles Administration, the names of the actual file and directory must be exactly the same as that in the error message.
Subbook is not the same as
subBook. First, look in the
templates directory and ensure that there is a subdirectory with the template name. Next, look inside that subdirectory for the template configuration file. If either the directory or file is named incorrectly, renaming them to the correct spelling should fix the error.
If there is no
templates subdirectory that comes even close to having the correct name, there are two ways to fix the error temporarily. The first method is to rename another subdirectory (and the template configuration file inside it) to the name phpBB is trying to find. When doing this, be sure to write down the original name for a quick change-back later. The second and better method is to copy another template and rename it. The steps for this are the same as those in the Creating a Copy Style section earlier in this chapter, except you will not need to edit
theme_info.cfg. With the problem repaired for the moment, you can try to uninstall the problem style or work out a more lasting solution like replacing the
templates files of the style.
At some point, you may decide that you want to remove a style you have added to your phpBB forum. This is a much simpler process than installing styles. There are two steps to removing a style: deleting the style and theme information from the database and deleting the
templates directory of the style.
In the Administration Control Panel, scroll the navigation menu down to the Styles Admin section. Clicking the Management link will load a Styles Administration page, listing the styles currently installed on your forum. It looks very similar to the installation page you have already seen. By clicking the Delete link next to a style, you will remove all information related to that style in your forum’s SQL database. You will be asked to confirm the deletion before it actually happens. Any users that have selected a style in their profiles will automatically have their selection changed when that style is deleted. Their profile setting will be altered to the style selected as the Board Default on the General Configuration page of the Administration Control Panel.
If you only have one style installed on your forum, you cannot delete it. You also cannot delete the Board Default style
The second aspect of removing a style calls for deleting that style’s related subdirectory of the
templates directory. This will typically be done through the same means by which you copied the style into
templates when installing it. Since it is possible to have multiple styles that use a single template or image set element with different themes, you should make certain that removing these files will not damage any styles you have not deleted in the Administration Control Panel.