Iframes in phpBB

I am currently tinkering with a phpBB3 installation for a forum I ran until the summer of this year – Coffeehouse Chat. I shut the site down in the summer, but am now contemplating opening it up again. However, I want to try a few new things out on the site, including some ’embedded content’ where I include content generated elsewhere on my site in forum posts and pages.

The easiest way to do this seemed to me to be use the HTML IFRAME tag, but I wanted to do this within the context of Forum posts, and didn’t want to get in to having to create separate template pages for these special pages within Forum threads. I therefore decided to use BBCode tags and use those to code IFRAME tags.

There are always warnings about implementing any form of BBCode that can in principle allow a user to put code from another site dircetly in to your page – and quite rightly so. However, I felt reasonably comfortable about the approach I was going to take, as rather than make available a ‘generic’ BBCode version of an IFRAME tag, I was going to create a series of BBCodes that would only insert an IFRAME tag with a pre-specified URL and other attributes in to the page.

The approach was as follows:

Install the code that I wanted to run in the IFRAME within a sub-directory on my web server.

Tweak that code so as to run within a window that would fit comfortably within the space available for a conventional phpBB forum post.

Within the phpBB administration screen, create a new BBCode to generate an IFRAME specific to the application in the sub-directory.  For example:


Here I decided that to add my game of ‘Battleships’ to a page I would simply create a BBCode tag called [battleships].

Write the corresponding HTML code that will be inserted in the page when the phpBB is encountered.  In this case, it’s as follows:


Because the URL is pre-set to a location within my own site, there is no problem if users of the Forum choose to use the BBCode on their own posts within the Forum.

The BBCode command can thus be placed on any page and brings in content generated from the predefined URL. I’ve used this approach to embed some Javascript applications in Forum posts, and it works very well as a means of delivering customised content within posts.


WordPress Template Pages

I use WordPress to run a few other websites, such as my CommunityHost site, and wanted to add a form to support a mailing list.  My hosting company, Servage, supports mailing lists and I’ve used them with some success, so I didn’t need to re-invent the wheel and decided that the best bet would be to somehow get the HTML form that Servage supply on to a WordPress page.

I did try the obvious – just paste the HTML source code in to a page – and that was about as effective as the proverbial cat flap in an elephant house.  So I then decided to create a new template page containing the code.  And for all who’re interested, here’s what I did in Version 2.3.x.

Continue reading