| 
| 4 
 
   Customizing Your Forum  Now that you have installed phpBB and gained some experience with the Administration 
    Control Panel, you are ready to begin altering some more advanced aspects 
    of the forum's appearance and features. Changing these areas of phpBB will 
    be essential for giving your forum a unique identity that stands out among 
    online forums. The appearance of a forum is mainly controlled by phpBB's styling 
    system, which manages the colors, images, and visual layout of the forum. 
    Features can be added, removed, or altered by installing modification scripts 
    downloaded from phpBB-related websites.   By the end of this chapter, you will have learned about:  
     The basics of a phpBB 2.0 style Correct methods of editing phpBB files How to add and remove styles  Common style installation problems  Ways to customize a style  The benefits of creating and altering styles  Methods of changing forum images  How to add new forum features   
     phpBB Styles  If you look at several different phpBB forums, you may notice several differences 
      in each forum. They may use different colors and images, display features 
      in a different order, or omit some features entirely. This multitude of 
      effects can be accomplished by using different phpBB styles. A phpBB style is the appearance of a forum, created by a combination of a layout, colors, 
      and images. When you installed phpBB, the default style, called subSilver, 
      was also installed. subSilver is the most commonly used style on phpBB forums, 
      but there are well over two hundred different styles that have been publicly 
      released. It is common for forums to have multiple styles available for 
      user selection.   When dealing with phpBB, you will sometimes see the terms style, theme, and template 
      used interchangeably. In this chapter, themes and templates are defined 
      as two smaller aspects of the overall style to reduce confusion. This is 
      the way the terms are used most often in phpBB's code and Administration 
      Control Panel. Even the latter sometimes uses theme in place of style, however. 
        
     Structure of a Style  In order to effectively customize a style, you must first understand the parts 
      that compose the design of that style. Styles, like houses, are built from 
      smaller components that work together to create a frame. That frame, like 
      the walls of the house, provides a structure for displaying the internal 
      contents of a forum. These frames can be very complex creations so let us 
      look at how the basic pieces are put together and stored, before we get 
      into the actual customization of a style.   
       Style Elements  Styles are composed of three primary style elements, or smaller portions that work together to create the overall visual appearance 
        of the style. These are the template, theme, and image set elements. Each 
        style is self-contained and includes all the style elements needed to 
        operate correctly.   The first and most important part of a style is the template element. The template element is a set of text files containing the entire markup that is used to generate 
        the visual layout of a forum. The markup consists mainly of a markup language such as Hypertext Markup Language (HTML) and phpBB's own special template features, but can also include client-side 
        scripting languages such as JavaScript. Template files are used to arrange 
        most of the information displayed by your forum. You can identify template 
        files by looking at the name of a file; all template files have names 
        ending with tpl. Some examples are index_body.tpl, viewtopic_body.tpl, and message_body.tpl. Although this is rare, it is possible for multiple styles to use one set of 
        template files with different themes and/or image sets.   The theme element of a forum style is a grouping of formatting rules used to define the 
        visual decoration of a forum. The most common uses of the theme are specifying 
        the font face, colors, background colors, and borders of page elements. 
        Theme elements can be difficult to locate because they can be stored in 
        three different locations. Most styles store theme data in one or more 
        Cascading Style Sheet (CSS) files, such as subSilver.css and formIE.css. The name of the CSS files will vary with each forum style, but many times, 
        there will be at least one CSS file named after the forum style. Some 
        styles will place their CSS formatting rules in the overall_header.tpl template file instead of a separate CSS file. Others may use a combination of 
        the overall_header.tpl technique and database storage of some values. The subSilver style uses the combination 
        method, but also includes a CSS file that can be used after a manual change. 
          An image set element includes all the images that are part of a style. Some examples are 
        the folder images, voting result bar graphics, and language-specific buttons 
        such as "Reply" and "New Topic." There are also images 
        that may be used mainly for decorative purposes, such as background or 
        header images. Decorative images are sometimes considered part of the 
        theme, instead of the image set.   
        In addition to the template files already discussed, the template element can 
        also contain two special configuration files related to the theme and 
        image set elements. The theme configuration file, theme_info.cfg, is used for saving theme database data associated with a template. The saved 
        data can then be imported into another forum's database later. For the 
        most part, you will only rarely need to edit this file. It is usually 
        automatically generated or provided as needed. The second configuration 
        file holds template configuration data. In most cases, that will merely 
        be a list of graphic files in the image set of a style. These template 
        configuration files have a name based on their matching template, such 
        as subSilver.cfg.   
       Style Storage  Details of all of the styles available on a forum are stored in the forum's SQL 
        database. The database only holds a list of installed styles, the name 
        of an associated template element for each style, and some limited theme 
        data. No image set data is stored in your database.   
        In most cases, a templates directory will contain two other subdirectories: admin and images. The admin subdirectory will contain template files used to display the Administration 
        Control Panel. The images subdirectory will hold the image set used in the style, and may have language-named 
        subdirectories, such as lang_english or lang_dutch, for images that display typed text in different languages. Some more advanced 
        styles may include directories other than admin and images.   
     Editing phpBB Files  Throughout this chapter, you will be learning about and using a new skill that 
      will be very useful to you as the administrator of a phpBB forum. You have 
      already learned about some of the powerful configurations and features available 
      through the Administration Control Panel, but there are many more that are 
      not found there. These features can only be accessed (or in some cases, 
      added) by editing phpBB's files yourself.   You must be careful to follow proper procedures when altering the files because 
      phpBB is a delicate and complicated set of scripts. Doing so can save you 
      a lot of headaches later, as many have learned first hand.   You will be reminded of these procedures at several later points in the book. 
      Try to follow them before manually editing any files, even if you are not 
      reminded. This cannot be stressed enough, because these procedures can save 
      you a lot of time when dealing with problems.   Before editing any file, the most important thing you should do is create a backup 
      of that file. This simply means creating a copy of the file in its current 
      condition. If you encounter problems due to your editing later, you can 
      replace the edited file with the backup. That will effectively revert your 
      forum to the pre-edited state of the file. At some point in your phpBB experience, 
      you will definitely need to use a backup of a file. Everyone makes mistakes 
      at some point, and it is nothing to be ashamed about. At other times, things 
      simply do not work. Regardless of the cause, very few mistakes can be permanently 
      fatal to a phpBB forum if you make backups before doing anything.   When you do edit a phpBB file, it is important to use the correct type of program. 
      phpBB uses three types of files: graphics, text files containing program 
      code, and text files containing display code. Graphics are standard image files you would see on any website and should be edited in 
      programs such as Jasc Paint Shop Pro, Adobe Photoshop, or any other program 
      capable of handling them. The text files, however, are special. Making a 
      mistake in a graphic file will not damage your forum, but making one in 
      a display code file or program code can easily cripple your forum.   Microsoft Notepad, perhaps the most commonly used text editor of the Microsoft 
      Windows operating system, cannot understand the Unix format fully. It displays 
      all the contents of a Unix text file on one long line, so Notepad is not 
      the best choice for phpBB administrators. WordPad editor, also included 
      with Microsoft Windows, is able to read Unix files without any problems. 
      Most dedicated phpBB coders use more advanced text-editing programs with 
      special features related to the PHP programming language. Some popular examples 
      are EditPlus, TextPad, and PHPEdit, but there are many more available. You 
      should, however, not need anything more complex than WordPad for the examples 
      here.   The display code files are the .tpl files of the template element and the .css files of the theme element we learned about earlier. Like the program code files, 
      these are plain text files saved in a Unix text file format. WordPad will 
      again be our choice for editing these files for the examples in this chapter. There are special HTML editing programs, 
      such as Dreamweaver MX, that can be used to edit template files. Those programs 
      tend to cause as many problems as they solve, so you may want to avoid them 
      for now unless you are very familiar with the program you choose.   
      Finally, there is one more note about editing both program and display code files. 
      When saving these files, you need to make certain to save them in the proper 
      file format. These are supposed to be plain text files, so you must save 
      them as that. To save an edited phpBB file in WordPad, just click the Save toolbar icon or select Save from the File menu. WordPad should automatically save the file correctly. If you must select 
      Save As, make certain to choose Text Document in the Saves as type selection list.   
      Microsoft WordPad may be able to read Unix file formats, but it does not save 
      files in that format. Instead, it saves files in a personal computer (PC) format.   
     Installing a New Style  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.  
 
 
 
 |  |