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:

phpbb-bbcode-1

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:

phpbb-bbcode-2

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.

 

0 thoughts on “Iframes in phpBB

  1. Hello Joe. Would you be able to help me? I realize this was posted in 2009. I am having problem using your example to create bbcode for embedding a google doc.

Leave a Reply

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