howto put google ads on a phpbb forum

I got to do something productive today! I finally managed to put Google Ads onto my project Broadband Exchange. I actually manage five or so PHPBB installations, but bEx (as I like to call it), is mine and mine alone, which allows me to a.) screw it up if I feel like it and b.) put humongous Google Ads again, should the wind blow in that direction.

At any rate, let me list down what I did, partially for myself, and mostly really for whoever else out there who wants to learn this stuff. But firstly some groundrules:

  • No more discussion about how PHPBB is better or less than Invision, PHPNuke, or some other out there. I learned my stuff on PHPBB, I checked out the endless discussions on maillists and forums, and tell you what, for every one phpbb testimonial, there’s another for Invision, and in reverse. Ad nauseam. So the thing to do really is, just give it up and go with what you know. If you get hacked, then likely it’s because of your fault really, not the software. Whoever’s relying too much on the software’s security to begin with (and not doing due maintenance) is to blame in the end, really. (And yes, I know. Having said that I’ll probably get hacked soon. Sheesh.)
  •  

  • b. I assume you know what you’re doing as far as FTP and adding / modifying / deleting files are concerned. My fave “trick” (not really a trick, more like a habit) is to rename a file before I edit it, something like sep012005_overall_header.tpl, where the previous file name was overall_header.tpl. I do so on the files on my local machine (yes you have to have the same exact files on your local machine. Didn’t your momma teach you that?), and the active ones on the server. They should mirror each other and you should keep that mirror clean with a cotton cloth and a dab of alcohol every so often. End of discussion.
  •  

  • My particular situation is rather different, I wanted to have a “facade” to my phpbb installation so as to greet a web visitor with the latest posts, some pertinent data and other stuff, as compared to going to the forum proper (yeah I know php-Nuke can do that. Read above.), so I used MX System. It started out as an experiment, and it turned out ok, so I’ll keep using it then. I also use the “Redline” template (sorry I couldn’t find a link!), which happened to have support for both MX System and PHPBB. I’ll try not to confuse you with those details, so pretend I never said anything about MX System and beside I won’t mention it on the Howto below, where I’ll just concentrate on the PHPBB part. Newbies will definitely get winded and it’s not necessary anyway.
  •  

  • type asterisk dot tplTo those really uninitiated with “modding” (aka modifying) PHPBB, PHPBB uses its own proprietary file format “.tpl” which is actually just .php files, except changed to that format primarily for security, and if there’s any other reason I don’t know what else. It’s a good trick as even your average PHP or HTML IDE will not recognize it and will therefore not show it to be an file available for edit in the Open File dialogue box. IDEs like my fave Homesite need to be ‘told’ to open it by typing *.tpl on the “Open File” field area. BTW if you don’t like mucking about your PHPBB, something nice to know is that there are many webmasters out there who don’t do anything else but mod phpbb and make a very good honest living out of it. Just PHPBB all – their – lives, nothing else. Imagine.
  •  

  • This also assumes you already know what you’re doing re Google Adsense. In this example, I used the largest skyscraper size “wide skyscraper 160×600”, but you can use the smaller skyscraper 120×600 size if you want. If you don’t know about this, go check it out first as there’s far too much info about that to teach you over here.
  •  
    Ok enough yada. Here we go with the HowTo proper:

    First we back up:

    1. Look for two files within your local phpbb folder:

       yourphpbbinstallation/templates/*name of your template here*/overall_footer.tpl

       
      and
       
      yourphpbbinstallation/templates/*name of your template here*/overall_header.tpl.
    2. rename them for backup purposes. Like I said above, I usually rename them by date, therefore they become:
       yourphpbbinstallation/templates/*name of your template here*/sep012005_overall_footer.tpl

      and

      yourphpbbinstallation/templates/*name of your template here*/sep012005_overall_footer.tpl

    3. Open these with your html editor or notepad.
    4.  

    5. Save them as their original names, overall_footer.tpl and overall_header.tpl. You nnow have a backup of the orig files to revert to when you screw things up.
    6.  

    7. Fire up your ftp application, and rename the overall_footer.tpl and overall_header.tpl files there as well.

     
    Now for the editing part:

    1. Open up overall_header.tpl with your html editor. Look for this line

      <table width=”500″ cellspacing=”0″ cellpadding=”10″ border=”0″ align=”center”>

    2. Directly above it, add this:

      <table width=”600″ cellspacing=”0″ cellpadding=”0″ border=”0″ align=”center”><tr><td>

      save it. Close the file.

    3. Now open up overall_footer.tpl with your html editor. Look for this line

      </table></td>
      </tr>
      </table>
      </body>
      </html>

      in between </table> and </body>, paste these:

      </td><td align=”center” valign=”top”><div align=”center”><br>

      PUT THE GOOGLE ADSENSE CODE HERE

      </div></td></tr></table>

      should look something like this:
      what its SUPPOSED to look like

    4. Upload overall_footer.tpl and overall_header.tpl onto yourphpbbinstallation/templates/*name of your template here*/. NOTE that your ftp server SHOULD NOT ask permission from you to overwrite the existing files, because as I taught you in the above backup howto, you should have renamed them and therefore there shouldn’t be files there to overwrite. CANCEL the overwrite and retrace your steps.
    5. Check your site, you should see the google ads at the side, like mine
    6. Let me know how yours went! If things go well (meaning if the lazy bug doesn’t bite), I’ll make another howto about putting adsense onto WordPress installations.

2 thoughts on “howto put google ads on a phpbb forum

  1. gabriel

    whoops hold on sarvpriya steel pipes! its been awhile since i posted that, so things may have changed since, especially with the formatting of overall_footer.tpl and overall_header.tpl.

    But the .tpl file format and the method of renaming files for backup remains the same.

    Proceed with caution, or just let me know if you run into probs :)

Leave a Reply

Your email address will not be published. Required fields are marked *