Bad Boy Blog, an unofficial Diddy and Bad Boy fan blog

Bookmark and Share

Installing a New Template

Installing a New Template

Postby JohnMcK » September 7th 2003, 8:32 pm

Installing a new template is one way of further customizing your phpBB to suit your tastes and give it a bit of a facelift. Many forum owners prefer to design a custom template but this certainly is not for everyone. Downloading a predesigned template is a viable alternative to subSilver. There are a number of templates available for download from a variety of sources, such as the phpBBHacks.com Templates section, which is the largest on the Internet.

Installing a new template that you"ve downloaded is not a difficult task, in most cases. That said, keep in mind that phpBB is a complex piece of software, so even something as innocent-sounding as installing a template should be done with care. As with any changes to your forums, be sure to keep back-ups of everything.

Obviously, your first step is to find a template you like and want to install on your forums. I"m assuming that you"ve already done so and downloaded it to your local computer.

Before we go on, a brief discussion of the "folder structure" that phpBB uses is in order. This is simply the layout of the folders and files making up your forums. As you"ve probably noticed there are quite a few files and a seemingly complex system of folders. The folders have been laid out in this manner by design and keeping this structure is critical to the proper functioning of your phpBB.

As far as the folders making up a template, the folder structure looks similar to this:

Code: Select all
phpBB2
  - admin
  - cache
  - db
  - docs
  - images
  - includes
  - language
  - templates
      - subSilver
	      - admin
		  - images


Note that the template subSilver is located in the templates folder. Note also, that most of the files making up the pages of your phpBB are stored in the subSilver folder, but also there are two folders inside of subSilver - admin and images, each containing additional files.

This structure is how phpBB knows what templates are available - it reads the folders inside of the templates folder. In this case, the only template available would be "subSilver". This structure is also how phpBB finds the files it needs. Also, please that spelling is very important to phpBB. As far as phpBB is concerned "subSilver", "Subsilver" and "SubSilver" are three different things.

Now, go ahead and unzip that template you downloaded,and you should see a folder structure similar to subSilver for your new template. Before you actually upload the files, you should apply any edits needed by the hacks you"ve installed, but we"ll come back to this a little later.

Assuming your new template is named "myTemplate", the easiest way to ensure that all files/folders remain where they belong is, using a tool like CuteFTP, SmartFTP, etc. to upload the myTemplate folder and all of its contents at once to the templates folder on your server. Your forum folders should now look like this:

Code: Select all
phpBB2
  - admin
  - cache
  - db
  - docs
  - images
  - includes
  - language
  - templates
      - myTemplate
	      - admin
		  - images
      - subSilver
	      - admin
		  - images


Now, phpBB would recognize that the templates subSilver and myTemplate have been uploaded.

OK, so the files are in place, now you have to tell phpBB to install the new template. Go to Admin Control Panel -> Styles Admin -> Add. If you"ve uploaded the files properly you should see "myTemplate" listed in the Styles Administration screen, along with an "Install" link. Note that, in this example, you would only see "myTemplate" in the list and not "subSilver". phpBB still recognized "subSilver" but did not include it in the list since it has already been installed. Click the "Install" link to install the template.

Your new template should now be installed and ready for testing.

Will my new template work with the hacks I've already installed?

Simply put, maybe. In terms of the affect on templates, there are three kinds of hacks.

  1. Hacks that do not include any template files (.tpl, .css or .cfg) and do not require you to edit any: These hacks change the way phpBB works, but not the way it looks. An example of this would be User Always Browsing. These hacks should work well with any template.
  2. Hacks that require you to edit template files (.tpl, .css or .cfg): Since these hacks required changes to template files, they will not automatically work with your new template. You will have to apply any edits from the hack to the files of your new template. Frequently, using the new template without editing the template files will not cause any problems other than it seeming that the hacks have not been installed.
  3. Hacks that include template files (.tpl, .css or .cfg) to be uploaded to your server: These hacks will not automatically work with your new template. In order to use the new template with any hacks of this type installed, you will have to take several steps. (1) Copy the template files that were included in the hack to your new template"s folders. (2) Edit these template files so that they have the same "look and feel" as the rest of the pages in your template. It would be impossible to say exactly how to do this since it would vary for each template. At the simplest it would require no further edits such as when adding subRed to a board that has subSilver installed. The most complex situation could require extensive knowledge of HTML and CSS. If you attempt to use a new template without adding the template files from the hack, you will certainly experience problems.


A word to the wise.
phpBB is made more "extensible" by the use of variables, constants and other declarations throughout the program. For example, most images used are defined in the .cfg file for the template. Then, where they are needed in the programming code, they are referred to as $image["some_image_name"]. The idea is, that image may be used repeatedly throughout the program, so rather than hunting down every place an image is used, you can change an image simply by changing one declaration in the .cfg file.

Especially in the case of hacks described in #3, above, if after installing your new template you have odd little problems like the wrong image, etc., you may have a situation where the hack author has "hard coded" the image path instead of using a variable. These are easy enough to fix, by either defining a variable or changing the hard coded path to point to the new template"s folder.

Testing the New Template.
Ok, so you"ve installed your new template, applied any edits so that the hacks you"ve installed will work with it and now you"re ready to go. But, before you jump in with both feet, you really should test the new template. Even if you haven"t installed any hacks, it"s a good idea to make sure everything went according to plan.

Let"s consider a hypothetical situation. Your new template has been uploaded to your server and you want to see what it looks like. So, you log-in, go to your profile and select the new template. And, "Oh, No!" something went wrong and now all you"re getting is errors. Hmm, that presents a problem, since you can"t get to your board, you can"t change your style back. First of all, this makes solving the problem that much tougher and also, if any other user sees the new template and decides to try it you will have an unhappy user. This is still fixable, of course, but it"s far better to avoid the problem in the first place.

Don"t dismiss this too easily, it has happened. If you browse the forums at phpBBHacks.com, you"ll find more than one user who locked themselves out of their forums simply by installing a new template.

To safeguard yourself against this problem, first create a test user. This would be a dummy account that you use for testing purposes. (It"s really a good idea to have one or more of these anyway.) So, you log-in using this test account and change to the new template. If all goes as planned, you"re finished. But, if there are problems, you can always log back in using your normal account. Then you can go to your Admin Control Panel and reset the test user back to a functioning template.

Before you are satisfied, it"s a good idea to fully test the new template with your test user. Try everything - posting, previewing posts, PM"s, look at the member list, user groups and all other features of your phpBB especially any hacks you"ve installed - make sure the calendar, attachments and easyCMS are still working as expected (for example). Better to know now if there is a problem than to have an angry mob of users beating at your door.

If all went well, you have a new look for your forum or maybe just another choice for your users. If not, I"m sure that it"s fixable, but will require some debugging. If you run into problems, be sure to post in the Support Forums for help.

John McKernan (JohnMcK)
Retired phpBBHacks.com Support Team Member
User avatar
JohnMcK
Dedicated User
 
Posts: 3868
Joined: April 7th 2003, 4:34 pm
Location: Quakertown, PA

Return to phpBB 2: Installation

Who is online

Users browsing this forum: No registered users and 0 guests